"use strict";
/**
 * @author hkargc@139.com
 * @link https://github.com/hkargv/paipan
 * 本日历及排盘类完全源于以下项目,本人仅作为代码搬运工,感谢项目作者的无私分享
 * 日历部分由bieyu.com搬运而来,其详细阐述了的历法转换原理及星体天文算法等,并提供了JS源码及部分PHP源码,项目地址: http://www.bieyu.com/
 * 农历校正及古代农历算法完全来自寿星万年历,感谢福建莆田第十中学许剑伟老师,项目地址: http://www.nongli.net/sxwnl/
 */
function paipan() {
	/**
	 * 标准时间发出地经度(角度表示,东经为正西经为负),北京时间的经度为+120度0分
	 */
	this.J = 120;
	/**
	 * 默认纬度(角度表示,北纬为正南纬为负),这里是中国标准时间发出地(陕西省渭南市蒲城县)
	 */
	this.W = 35;
	/**
     * 缓存每年的节气计算结果Jie Qi
     */
    this.JQ = [];
    /**
     * 缓存农历相关的计算结果Month code月代码
     */
    this.MC = [];
	/**
	 * 缓存synodic month朔望月
	 */
	this.SM = [];
    /**
     * 四柱是否区分"早晚子"时,true则23:00-24:00算成上一日柱
     */
    this.zwz = true;
	/**
     * 是否采用精确法"排大运",用于起运处,粗略法一年按360天算,精确法按回归年算
     */
    this.pdy = false;
    /**
     * 均值朔望月長 synodic month (new Moon to new Moon)
     */
    this.synmonth = 29.530588853;
	/**
     * 回归年长 Tropical year
     */
    this.ty = 365.24244475;
    /**
     * 星期 week day
     */
    this.wkd = ['日', '一', '二', '三', '四', '五', '六'];
    /**
     * 六十甲子
     */
    this.gz = [
        '甲子', '乙丑', '丙寅', '丁卯', '戊辰', '己巳', '庚午', '辛未', '壬申', '癸酉',
        '甲戌', '乙亥', '丙子', '丁丑', '戊寅', '己卯', '庚辰', '辛巳', '壬午', '癸未',
        '甲申', '乙酉', '丙戌', '丁亥', '戊子', '己丑', '庚寅', '辛卯', '壬辰', '癸巳',
        '甲午', '乙未', '丙申', '丁酉', '戊戌', '己亥', '庚子', '辛丑', '壬寅', '癸卯',
        '甲辰', '乙巳', '丙午', '丁未', '戊申', '己酉', '庚戌', '辛亥', '壬子', '癸丑',
        '甲寅', '乙卯', '丙辰', '丁巳', '戊午', '己未', '庚申', '辛酉', '壬戌', '癸亥'
    ];
    /**
     * 十天干 char of TianGan
     */
    this.ctg = ['甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸'];
    /**
     * 十二地支 char of DiZhi
     */
    this.cdz = ['子', '丑', '寅', '卯', '辰', '巳', '午', '未', '申', '酉', '戌', '亥'];
    /**
     * 十二生肖 char of symbolic animals ShengXiao
     */
    this.csx = ['鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊', '猴', '鸡', '狗', '猪'];
    /**
     * 廿四节气(从春分开始) JieQi
     */
    this.jq = ['春分', '清明', '谷雨', '立夏', '小满', '芒种', '夏至', '小暑', '大暑', '立秋', '处暑', '白露', '秋分', '寒露', '霜降', '立冬', '小雪', '大雪', '冬至', '小寒', '大寒', '立春', '雨水', '惊蛰'];
    /**
     * 大写月份
     */
    this.dxy = ['正月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '冬月', '腊月'];
    /**
     * 大写日期
     */
    this.dxd = ['初一', '初二', '初三', '初四', '初五', '初六', '初七', '初八', '初九', '初十', '十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十九', '二十', '廿一', '廿二', '廿三', '廿四', '廿五', '廿六', '廿七', '廿八', '廿九', '三十'];
    /**
     * 大写数字
     */
    this.dxs = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
    /**
     * 五行 char of WuXing
     */
    this.cwx = ['金', '水', '木', '火', '土'];
    /**
     * 性别 XingBie
     */
    this.xb = ['男', '女'];
    /**
     * 命造 mingzao
     */
    this.mz = ['乾', '坤'];
    /**
     * 阴阳 char of YingYang
     */
    this.cyy = ['阳', '阴'];
    /**
     * 类型
     */
    this.lx = ['印绶', '比劫', '食伤', '才财', '官杀'];
    /**
     * 天干的五行屬性,01234分別代表:金水木火土
     */
    this.wxtg = [2, 2, 3, 3, 4, 4, 0, 0, 1, 1];
    /**
     * 地支的五行屬性,01234分別代表:金水木火土
     */
    this.wxdz = [1, 4, 2, 2, 4, 3, 3, 4, 0, 0, 4, 1];
    /**
     * 十神全称
     */
    this.ssq = ['正印', '偏印', '比肩', '劫財', '傷官', '食神', '正財', '偏財', '正官', '偏官'];
    /**
     * 十神缩写
     */
    this.sss = ['印', '卩', '比', '劫', '伤', '食', '财', '才', '官', '杀'];
    /**
     * 日干關聯其餘各干對應十神 Day Gan ShiShen
     */
    this.dgs = [
        [2, 3, 1, 0, 9, 8, 7, 6, 5, 4],
        [3, 2, 0, 1, 8, 9, 6, 7, 4, 5],
        [5, 4, 2, 3, 1, 0, 9, 8, 7, 6],
        [4, 5, 3, 2, 0, 1, 8, 9, 6, 7],
        [7, 6, 5, 4, 2, 3, 1, 0, 9, 8],
        [6, 7, 4, 5, 3, 2, 0, 1, 8, 9],
        [9, 8, 7, 6, 5, 4, 2, 3, 1, 0],
        [8, 9, 6, 7, 4, 5, 3, 2, 0, 1],
        [1, 0, 9, 8, 7, 6, 5, 4, 2, 3],
        [0, 1, 8, 9, 6, 7, 4, 5, 3, 2]
    ];
    /**
     * 日干關聯各支對應十神 Day Zhi ShiShen
     */
    this.dzs = [
        [0, 1, 8, 9, 6, 7, 4, 5, 3, 2],
        [6, 7, 4, 5, 3, 2, 0, 1, 8, 9],
        [2, 3, 1, 0, 9, 8, 7, 6, 5, 4],
        [3, 2, 0, 1, 8, 9, 6, 7, 4, 5],
        [7, 6, 5, 4, 2, 3, 1, 0, 9, 8],
        [5, 4, 2, 3, 1, 0, 9, 8, 7, 6],
        [4, 5, 3, 2, 0, 1, 8, 9, 6, 7],
        [6, 7, 4, 5, 3, 2, 0, 1, 8, 9],
        [9, 8, 7, 6, 5, 4, 2, 3, 1, 0],
        [8, 9, 6, 7, 4, 5, 3, 2, 0, 1],
        [7, 6, 5, 4, 2, 3, 1, 0, 9, 8],
        [1, 0, 9, 8, 7, 6, 5, 4, 2, 3]
    ];
    /**
     * 十二星座 char of XingZuo
     */
    this.cxz = ['摩羯', '水瓶', '双鱼', '白羊', '金牛', '双子', '巨蟹', '狮子', '处女', '天秤', '天蝎', '射手'];
    /**
     * 地支藏干表 支藏干
     */
    this.zcg = [
        [9, -1, -1],
        [5, 9, 7],
        [0, 2, 4],
        [1, -1, -1],
        [4, 1, 9],
        [2, 4, 6],
        [3, 5, -1],
        [5, 1, 3],
        [6, 8, 4],
        [7, -1, -1],
        [4, 7, 3],
        [8, 0, -1]
    ];
    /**
     * 十二长生 char of ZhangSheng
     */
    this.czs = ["長生(強)", "沐浴(凶)", "冠帶(吉)", "臨官(大吉)", "帝旺(大吉)", "衰(弱)", "病(弱)", "死(凶)", "墓(吉)", "絕(凶)", "胎(平)", "養(平)"];
    this.yyss = ['異', '同'];
    this.sxss = ['生我', '同我', '我生', '我克', '克我'];
    /**
     * 方位 char of FangWei
     */
    this.cfw = ["　中　", "　北　", "北北東", "東北東", "　東　", "東南東", "南南東", "　南　", "南南西", "西南西", "　西　", "西北西", "北北西"];
    /**
     * 四季 char of SiJi
     */
    this.csj = ["旺四季", "　春　", "　夏　", "　秋　", "　冬　"];
    /**
     * 天干的方位屬性 FangWei TianGan
     */
    this.fwtg = [4, 4, 7, 7, 0, 0, 10, 10, 1, 1];
    /**
     * 地支的方位屬性 FangWei DiZhi
     */
    this.fwdz = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
    /**
     * 天干的四季屬性 SiJi TianGan
     */
    this.sjtg = [1, 1, 2, 2, 0, 0, 3, 3, 4, 4];
    /**
     * 地支的四季屬性 SiJi DiZhi
     */
    this.sjdz = [1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 1];
	/**
	 * 节气修复 XiuFu 使农历-720年至2300年与寿星万年历匹配,键分别为公历年份和该年自春分开始的廿四节气
	 */
	this.jqXFu = {
		'-680':{9:-1},
		'-643':{14:-1},
		'-638':{1:-1},
		'-567':{20:-1},
		'-557':{17:-1},
		'-545':{10:-1},
		'-523':{18:-1},
		'-512':{10:-1},
		'-492':{2:-1},
		'-479':{10:-1},
		'-446':{10:-1},
		'-322':{0:-1},
		1646:{1:-1,9:1,22:-1,23:-1},
		1647:{0:-1},
		1650:{1:-1,9:1,11:1,22:-1},
		1651:{0:-1,3:-1},
		1652:{11:-1},
		1653:{2:-1},
		1654:{0:-1,1:-1,11:1,17:-1},
		1655:{0:-1,3:-1,20:1},
		1656:{10:1,13:1},
		1657:{2:-1,8:1,20:-1},
		1658:{5:-1,11:1,21:-1},
		1659:{3:-1,6:-1},
		1660:{7:1,10:1,13:1,15:1},
		1661:{2:-1,12:1,20:-1},
		1662:{5:-1,11:1,21:-1},
		1663:{3:-1,23:-1},
		1664:{10:1,13:1,15:1,19:-1},
		1665:{2:-1,4:-1,12:1,20:-1},
		1666:{21:-1},
		1667:{22:-1,23:-1},
		1668:{14:1,19:-1},
		1669:{4:-1,12:1},
		1670:{21:-1},
		1671:{1:-1,18:-1,22:-1,23:-1},
		1672:{0:-1,14:1},
		1673:{12:1,16:1},
		1675:{1:-1,9:1,22:-1,23:-1},
		1676:{0:-1,14:1},
		1677:{16:1},
		1678:{4:-1},
		1679:{1:-1,4:-1,9:1,22:-1,23:-1},
		1680:{0:-1,3:-1},
		1682:{2:-1},
		1683:{1:-1,11:1,22:-1},
		1684:{0:-1,3:-1},
		1685:{10:1},
		1686:{2:-1,8:1},
		1687:{1:-1,5:-1,11:1},
		1688:{0:-1,3:-1,6:-1},
		1689:{10:1,13:1},
		1690:{2:-1,20:-1},
		1691:{5:-1,11:1,21:-1},
		1692:{3:-1,21:1},
		1693:{10:1,13:1,15:1},
		1694:{2:-1,4:-1,12:1,20:-1},
		1695:{21:-1},
		1696:{23:-1},
		1697:{13:1,15:1,19:-1},
		1698:{2:-1,4:-1,12:1,20:-1},
		1699:{21:-1},
		1700:{1:-1,23:-1},
		1701:{15:1,19:-1},
		1702:{4:-1,12:1,20:-1},
		1703:{21:-1},
		1704:{1:-1,9:1,22:-1,23:-1},
		1705:{0:-1,14:1},
		1708:{1:-1,9:1,18:-1,22:-1,23:-1},
		1709:{0:-1},
		1710:{16:1},
		1712:{1:-1,11:1,22:-1,23:-1},
		1713:{0:-1,3:-1},
		1714:{10:1},
		1715:{2:-1,8:1},
		1716:{1:-1,5:-1,11:1,22:-1},
		1717:{0:-1,3:-1,6:-1},
		1718:{10:1},
		1719:{2:-1},
		1720:{5:-1,11:1},
		1721:{0:-1,3:-1},
		1722:{10:1,13:1},
		1723:{2:-1,4:-1},
		1724:{21:-1},
		1725:{3:-1},
		1726:{13:1,15:1},
		1727:{2:-1,4:-1,12:1,20:-1},
		1728:{21:-1},
		1729:{23:-1},
		1730:{13:1,14:1,15:1},
		1731:{4:-1,12:1,20:-1},
		1732:{21:-1},
		1733:{1:-1},
		1735:{20:-1},
		1738:{19:-1},
		1740:{21:-1},
		1744:{8:-1},
		1745:{23:-1},
		1747:{7:-1},
		1749:{1:-1},
		1751:{13:1},
		1753:{5:-1,22:-1},
		1756:{12:1},
		1760:{2:-1},
		1773:{21:-1},
		1774:{11:1},
		1776:{16:1},
		1778:{23:-1},
		1779:{6:-1},
		1781:{17:1},
		1782:{1:-1},
		1784:{13:1},
		1786:{22:-1},
		1806:{21:-1},
		1808:{19:-1},
		1809:{16:1},
		1811:{23:-1},
		1815:{1:-1},
		1817:{13:1},
		1819:{22:-1},
		1824:{9:1},
		1826:{4:-1},
		1829:{15:1},
		1836:{11:1},
		1844:{5:1},
		1846:{16:1},
		1848:{18:1},
		1849:{3:-1},
		1850:{13:1},
		1851:{12:1,17:1},
		1855:{2:-1},
		1862:{14:1,15:1},
		1864:{8:1},
		1866:{14:1},
		1867:{7:1,10:1},
		1878:{19:1},
		1879:{16:1},
		1883:{13:1},
		1884:{12:1,17:1},
		1886:{9:1},
		1895:{14:1,15:1},
		1898:{11:1},
		1899:{6:1,14:1},
		1912:{16:1},
		1913:{12:1},
		1917:{17:-1},
		1922:{22:-1},
		1927:{11:-1},
		1928:{6:-1},
		1951:{18:1},
		1978:{20:-1},
		2295:{5:1}
	};
	/**
	 * 朔望月moon修复 XiuFu 使农历-720年至2300年与寿星万年历匹配,键分别为公历年份和该年第几个朔望日
	 */
	this.smXFu = {
		618:{13:-1},
		620:{13:-1},
		626:{5:1},
		627:{12:-1},
		628:{9:-1,12:-1},
		629:{6:1},
		634:{4:1},
		635:{4:1},
		636:{5:1},
		637:{6:1,9:1},
		639:{10:-1},
		640:{12:1},
		642:{3:1},
		643:{3:1},
		644:{1:1,4:1},
		645:{3:-1,8:1,9:1,11:1},
		646:{1:-1,3:-1,5:-1,8:1,10:1},
		647:{4:-1,9:1,11:1},
		648:{4:-1,5:-1,10:1,12:1},
		649:{4:-1,6:-1,12:1},
		650:{2:1,7:-1,9:-1,11:-1},
		651:{2:1,4:1,11:-1},
		652:{1:-1,5:1,7:1,12:-1},
		653:{2:-1,8:1,10:1,13:-1},
		654:{2:-1,7:1,9:1},
		655:{3:-1,5:-1,8:1,10:1},
		656:{3:-1,4:-1,9:1,11:1,13:1},
		657:{3:-1,5:-1,9:1,11:1},
		658:{1:1,6:-1,8:-1,10:-1,12:1},
		659:{1:1,3:1,8:-1,10:-1},
		660:{4:1,6:1,11:-1},
		661:{1:-1,7:1,9:1,12:-1},
		662:{1:-1,6:1,8:1},
		663:{2:-1,7:1,9:1},
		664:{2:-1,3:-1,8:1,10:1,12:1},
		665:{2:-1,4:-1,8:1,10:1,12:1},
		666:{3:1},
		667:{5:1},
		672:{4:1},
		680:{1:-1},
		682:{10:-1},
		683:{1:-1,11:-1},
		684:{1:1},
		687:{6:1},
		690:{12:-1},
		697:{11:1,12:1},
		698:{8:1},
		704:{5:1},
		706:{10:1},
		708:{10:1},
		709:{2:1,9:1},
		710:{2:1,5:1,7:1,10:1,12:1},
		712:{2:1,7:1},
		713:{1:1,5:1,7:1},
		714:{3:1},
		715:{4:1,7:1},
		716:{4:1,7:1,9:1},
		717:{1:1},
		718:{9:1,13:1},
		719:{1:1},
		721:{7:1},
		722:{6:1,9:1},
		723:{3:1,9:1,12:1},
		724:{8:1,12:1},
		725:{4:1,7:1,12:1},
		726:{5:1,12:1},
		727:{5:1,8:1,12:1},
		729:{3:1,8:-1},
		732:{6:1,8:1},
		733:{3:1,6:1},
		736:{2:-1},
		737:{2:-1,9:1},
		738:{7:1,9:1},
		741:{2:1,5:1,7:1,10:1},
		742:{1:1,3:1,6:1,10:1},
		743:{3:1,6:1},
		744:{4:1,7:1,10:1},
		745:{8:1,11:1},
		746:{4:1,8:1},
		747:{4:1},
		748:{7:1},
		749:{4:1,6:1},
		750:{5:1,9:1},
		751:{1:1,3:1,6:1},
		752:{9:1,12:1},
		753:{10:1},
		754:{10:1},
		755:{3:-1},
		757:{3:1,8:1},
		758:{4:1,6:1,12:1},
		759:{2:1,5:1,12:1},
		760:{2:1,5:1,8:1,11:1},
		761:{6:1,9:1,12:1},
		762:{6:1,9:1,11:1},
		763:{7:1,10:1,12:1},
		764:{3:1,13:1},
		765:{5:1},
		766:{3:1,5:1},
		767:{4:1,11:1},
		768:{4:1,7:1,10:1},
		769:{5:1,10:1},
		770:{6:1,9:1},
		772:{2:1,10:1},
		773:{1:1,10:1,12:1},
		774:{7:1},
		775:{1:1,3:1,7:1,10:1},
		777:{4:1,7:1},
		778:{5:1,8:1,10:1},
		779:{5:1,10:1},
		780:{1:1,2:1,13:1},
		782:{1:1,10:1},
		783:{4:1,9:1,11:1,13:1},
		785:{12:1},
		787:{4:1,12:1},
		788:{12:1},
		790:{3:1},
		791:{3:1,10:1},
		792:{5:1,10:1,12:1},
		793:{11:1},
		794:{1:1,6:1,8:1},
		795:{3:1,6:1},
		796:{4:1},
		799:{2:1},
		802:{5:1,13:1},
		804:{1:1},
		806:{10:1},
		807:{1:1,11:1},
		808:{5:1,7:1,9:1},
		809:{4:1},
		810:{7:1,12:1},
		811:{4:1,6:1,9:1,12:1},
		812:{2:1,9:1},
		813:{1:1,3:1},
		814:{3:1,9:1,12:1},
		815:{1:1,7:1,10:1},
		816:{1:1,8:1,11:1,13:1},
		817:{6:1},
		818:{1:1},
		819:{3:1,8:1},
		820:{4:1,6:1,8:1},
		821:{5:1,12:1},
		822:{2:1,5:1,8:1,11:1},
		823:{6:1,9:1,11:1},
		824:{7:1,12:1},
		825:{3:1,5:1,7:1,10:1,12:1},
		826:{3:1,6:1,11:1},
		827:{1:1,3:1,6:1},
		828:{1:1,3:1,5:1,8:1},
		829:{4:1,8:1,11:1},
		830:{4:1,7:1,10:1},
		831:{5:1,8:1,10:1},
		832:{6:1,9:1,11:1},
		833:{2:1,6:1},
		834:{2:1,5:1,10:1},
		835:{2:1,5:1,11:1,13:1},
		836:{2:1},
		837:{1:1,3:1,5:1,7:1,10:1},
		838:{3:1,9:1},
		839:{4:1,7:1,9:1},
		840:{5:1,8:1,10:1},
		841:{1:1,5:1},
		842:{1:1,4:1,6:1},
		843:{10:1},
		844:{1:1,4:1,10:1},
		845:{2:1,4:1,9:1,11:1},
		846:{1:1,7:1,12:1},
		847:{3:1,6:1,9:1,12:1},
		848:{4:1,7:1,9:1,13:1},
		849:{4:1,12:1},
		850:{3:1,5:1,12:1},
		851:{4:1,6:1},
		852:{3:1},
		853:{3:1,6:1,8:1,10:1},
		854:{6:1,11:1,13:1},
		855:{8:1,11:1},
		856:{1:1,6:1,8:1},
		857:{3:1,6:1,11:1},
		858:{2:1,4:1,7:1,11:1},
		859:{3:1,5:1},
		860:{2:1,8:1},
		861:{2:1,9:1},
		862:{3:1,8:1,10:1},
		863:{5:1,7:1,12:1},
		864:{5:1},
		865:{1:1,6:1,8:1,11:1},
		866:{1:1,3:1,10:1},
		867:{2:1,4:1,10:1},
		868:{4:1,10:1},
		869:{1:1,8:1,11:1},
		870:{2:1,5:1,7:1,9:1},
		871:{4:1},
		872:{7:1},
		873:{5:1,7:1,10:1,13:1},
		874:{5:1,9:1},
		875:{3:1,6:1,9:1},
		876:{3:1,9:1,12:1},
		877:{7:1,10:1},
		878:{4:1,8:1,11:1,13:1},
		879:{3:1,6:1,11:1},
		880:{1:1,6:1},
		881:{2:1,4:1,9:1},
		882:{4:1,6:1,8:1},
		883:{5:1,12:1},
		884:{6:1,9:1,12:1},
		885:{6:1,9:1,11:1},
		886:{7:1,10:1,12:1},
		887:{3:1,5:1,10:1,12:1},
		888:{3:1,11:1},
		889:{1:1,3:1,6:1},
		890:{1:1,3:1,5:1},
		891:{4:1,11:1},
		892:{8:1,11:1},
		893:{5:1,8:1,10:1},
		894:{11:1},
		895:{2:1,6:1},
		896:{2:1,5:1,10:1},
		897:{2:1,5:1,11:1,13:1},
		898:{2:1,4:1,7:1},
		899:{1:1,5:1,7:1,10:1},
		900:{2:1,10:1},
		901:{4:1,7:1,9:1},
		902:{5:1,10:1},
		903:{2:1,6:1},
		904:{1:1,4:1,6:1},
		905:{1:1,10:1},
		906:{1:1,8:1,10:1},
		907:{4:1,9:1,11:1},
		908:{1:1,12:1},
		909:{1:1,6:1,12:1},
		910:{4:1,7:1,9:1},
		911:{1:1,5:1,13:1},
		912:{3:1,5:1,12:1},
		913:{4:1},
		914:{3:1,9:1},
		915:{3:1,6:1,8:1,10:1},
		916:{6:1,11:1,13:1},
		917:{8:1,11:1},
		918:{1:1,6:1,8:1},
		919:{2:1,4:1,12:1},
		920:{2:1,4:1,11:1},
		921:{3:1,5:1,11:1},
		922:{3:1,12:1},
		923:{2:1,5:1,7:1},
		924:{8:1,10:1},
		925:{7:1,12:1},
		926:{5:1,7:1},
		927:{1:1,6:1,8:1,11:1},
		928:{1:1,3:1,10:1},
		929:{2:1,4:1,10:1},
		930:{2:1,11:1},
		931:{1:1,11:1},
		932:{5:1,7:1,12:1},
		933:{4:1},
		934:{2:1,4:1,7:1},
		935:{5:1,7:1,10:1,13:1},
		936:{5:1,9:1},
		937:{2:-1,9:1},
		938:{2:-1,3:-1,8:1,10:1,13:1},
		939:{10:1,12:1},
		940:{4:1,6:1,11:1,13:1},
		941:{3:1,6:1,11:1},
		942:{1:1,6:1},
		943:{2:1,4:1,6:1,9:1},
		944:{2:1,4:1,8:1},
		945:{8:1,12:1},
		946:{7:1,9:1,12:1},
		947:{7:1,11:1},
		948:{12:1},
		949:{6:1,13:1},
		950:{11:1},
		951:{1:1,3:1,6:1,8:1},
		952:{1:1,3:1,5:1},
		953:{2:1,11:1},
		954:{8:1,11:1},
		955:{6:1,8:1,10:1},
		956:{7:1,11:1},
		957:{3:1,5:1},
		958:{2:1,10:1},
		959:{2:1,5:1,11:1},
		960:{1:1,3:1,5:1,8:1,10:1,12:1},
		961:{1:1,3:1,7:1,10:1},
		962:{2:1,7:1,10:1},
		963:{7:1,9:1},
		964:{1:1,5:1,10:1},
		965:{2:1,6:1},
		966:{1:1,4:1},
		967:{1:1},
		968:{2:1,7:1,9:1,11:1},
		969:{4:1,9:1,11:1},
		970:{1:1,12:1},
		971:{1:1,6:1,12:1},
		972:{2:1,9:1},
		973:{1:1,3:1,5:1,13:1},
		974:{3:1,12:1},
		976:{4:1,8:1},
		977:{3:1,6:1,8:1,10:1},
		978:{6:1,11:1},
		979:{1:1,6:1,9:1,12:1},
		980:{1:1,6:1,8:1},
		981:{2:1,12:1},
		982:{2:1,8:1,11:1},
		983:{3:1,9:1,11:1},
		984:{3:1,7:1,12:1},
		985:{2:1,5:1,7:1},
		986:{3:1,5:1,8:1},
		987:{8:1},
		988:{5:1,7:1},
		989:{1:1,11:1},
		990:{1:1,10:1},
		991:{2:1,8:1,10:1},
		992:{2:1,9:1,11:1},
		993:{1:1,6:1,11:1},
		994:{2:1,7:1,12:1},
		995:{2:1,5:1},
		996:{2:1,4:1},
		997:{3:1,5:1,7:1,10:1},
		998:{1:1,10:1},
		999:{7:1,9:1},
		1000:{1:1,8:1,10:1,13:1},
		1001:{1:1,8:1,10:1,12:1},
		1002:{1:1,4:1,6:1,11:1},
		1003:{1:1,4:1,12:1},
		1004:{1:1,6:1},
		1005:{2:1,4:1,6:1,9:1},
		1006:{3:1,9:1},
		1007:{8:1,12:1},
		1008:{7:1,9:1,12:1},
		1009:{7:1,11:1},
		1010:{3:1,5:1,8:1,12:1},
		1011:{6:1,13:1},
		1012:{11:1},
		1013:{1:1,3:1,8:1,12:1},
		1014:{2:1,6:1,11:1},
		1015:{2:1,11:1},
		1016:{3:1,6:1,8:1,11:1},
		1017:{6:1,10:1},
		1018:{2:1,7:1,11:1},
		1019:{3:1,5:1,8:1},
		1020:{2:1,8:1},
		1021:{2:1,5:1,9:1,11:1},
		1022:{1:1,5:1,8:1,10:1,12:1},
		1023:{1:1,7:1,10:1,12:1},
		1024:{2:1,7:1,10:1},
		1025:{1:-1,3:1,6:1,10:1},
		1026:{1:1,3:1,6:1},
		1027:{4:1,7:1},
		1028:{1:1,4:1,7:1},
		1029:{1:1,8:1},
		1030:{7:1,9:1,11:1},
		1031:{4:1,6:1,9:1,11:1},
		1032:{1:1,9:1,12:1},
		1033:{2:1,5:1,9:1,13:1},
		1034:{2:1,5:1,9:1},
		1035:{1:1,3:1,6:1},
		1036:{1:1,4:1,7:1,10:1,13:1},
		1037:{7:1},
		1038:{4:1,8:1},
		1039:{3:1,8:1,10:1},
		1040:{11:1},
		1041:{1:1,6:1,9:1,12:1},
		1042:{1:1,4:1,8:1},
		1043:{2:1,5:1,11:1,12:1},
		1044:{3:1,6:1,9:1},
		1045:{6:1,9:1,11:1},
		1046:{3:1,7:1,10:1,12:1},
		1047:{2:1,5:1,7:1,12:1},
		1048:{5:1},
		1049:{3:1,8:1,13:1},
		1050:{3:1,5:1,7:1,10:1},
		1051:{1:1,4:1,11:1},
		1052:{2:1,5:1,8:1,11:1},
		1053:{5:1,8:1,10:1},
		1054:{2:1,6:1,9:1,11:1},
		1055:{2:1,7:1,10:1,12:1},
		1056:{12:1},
		1057:{2:1,5:1},
		1058:{2:1,4:1},
		1059:{3:1,5:1,10:1},
		1060:{1:1,4:1,10:1},
		1061:{4:1,7:1,9:1},
		1062:{1:1,5:1,8:1,10:1},
		1063:{1:1,6:1,9:1,13:1},
		1064:{4:1,6:1,9:1},
		1065:{1:1,4:1,12:1},
		1066:{1:1,3:1,6:1,12:1},
		1067:{2:1,4:1,6:1,9:1},
		1068:{3:1,9:1},
		1069:{3:1,6:1,8:1,12:1},
		1070:{4:1,7:1,12:1},
		1071:{5:1,8:1,12:1},
		1072:{3:1,5:1,8:1,12:1},
		1073:{3:1,9:1},
		1074:{9:1,11:1},
		1075:{1:1,3:1,8:1,10:1,12:1},
		1076:{2:1,6:1,8:1,11:1},
		1077:{2:1,11:1},
		1078:{3:1,6:1,8:1,11:1},
		1079:{4:1,7:1,11:1},
		1080:{2:1,4:1,7:1},
		1081:{5:1,8:1},
		1082:{3:1,9:1},
		1083:{2:1,5:1,7:1,9:1,11:1},
		1084:{5:1,10:1,12:1},
		1085:{1:1,7:1,10:1,12:1},
		1086:{2:1,5:1,7:1,10:1},
		1087:{1:1,3:1,6:1,10:1},
		1088:{1:1,3:1,6:1},
		1089:{4:1,7:1},
		1090:{2:1,5:1,8:1},
		1091:{1:1,4:1,8:1},
		1092:{4:1,7:1,9:1},
		1093:{6:1,9:1,11:1},
		1094:{9:1,12:1},
		1095:{2:1,5:1,7:1,9:1,13:1},
		1096:{2:1,5:1},
		1097:{3:1,6:1,9:1,12:1},
		1098:{1:1,4:1,7:1,10:1,13:1},
		1099:{7:1,10:1},
		1100:{4:1,6:1,8:1},
		1101:{4:1,9:1},
		1102:{6:1},
		1103:{4:1,6:1,12:1},
		1104:{1:1,4:1,8:1},
		1105:{2:1,5:1,8:1,11:1,12:1},
		1106:{3:1,6:1,9:1},
		1107:{6:1,9:1,11:1},
		1108:{3:1,7:1,10:1,12:1},
		1109:{3:1,6:1,8:1,13:1},
		1110:{5:1},
		1111:{3:1,5:1,8:1},
		1112:{4:1,6:1,8:1,11:1},
		1113:{1:1,4:1},
		1114:{2:1,5:1,8:1},
		1115:{5:1,8:1,10:1},
		1116:{2:1,6:1,9:1,11:1},
		1117:{2:1,5:1,7:1,10:1,12:1},
		1118:{10:1,12:1},
		1119:{2:1},
		1120:{1:1,3:1,5:1,10:1},
		1121:{3:1},
		1122:{4:1,7:1,10:1},
		1123:{4:1,7:1,9:1},
		1124:{1:1,5:1,8:1},
		1125:{1:1,6:1,9:1,13:1},
		1126:{4:1,6:1,9:1},
		1127:{1:1,4:1,10:1,12:1},
		1128:{2:1,4:1,7:1,9:1,13:1},
		1129:{2:1,6:1,9:1},
		1130:{3:1,9:1},
		1131:{3:1,6:1,8:1,12:1},
		1132:{4:1,7:1,12:1},
		1133:{5:1,8:1,12:1},
		1134:{3:1,5:1,8:1},
		1135:{3:1,6:1,9:1},
		1136:{3:1,6:1,10:1,12:1},
		1137:{3:1,8:1,10:1,12:1},
		1138:{2:1,8:1,11:1},
		1139:{3:1,6:1,8:1,12:1},
		1140:{3:1,6:1,8:1,11:1},
		1141:{4:1,7:1,11:1},
		1142:{2:1,4:1,7:1},
		1143:{5:1,8:1},
		1144:{9:1},
		1145:{2:1,5:1,7:1,9:1},
		1146:{5:1,10:1,12:1},
		1147:{13:1},
		1148:{2:1,5:1,7:1,10:1},
		1149:{1:1,3:1,6:1,10:1},
		1150:{1:1,3:1,6:1},
		1151:{4:1,7:1,10:1},
		1152:{1:1,2:1,8:1,11:1},
		1153:{1:1,4:1,8:1},
		1154:{4:1,7:1,9:1},
		1155:{7:1,12:1},
		1156:{4:1,6:1,9:1,12:1},
		1157:{2:1,5:1,9:1},
		1158:{1:1,3:1,6:1},
		1159:{3:1,6:1,9:1,12:1},
		1160:{1:1,4:1,7:1,10:1,13:1},
		1161:{7:1,10:1,12:1},
		1162:{6:1,8:1},
		1163:{1:1,4:1},
		1164:{3:1},
		1165:{4:1,6:1},
		1166:{2:1,5:1,12:1},
		1167:{2:1,5:1,8:1,11:1,12:1},
		1168:{3:1,6:1,9:1,11:-1},
		1169:{6:1,9:1,11:1},
		1170:{3:1,7:1,10:1,12:1},
		1171:{3:1,6:1,8:1,11:1,13:1},
		1172:{5:1},
		1173:{1:1,3:1,5:1,8:1},
		1174:{4:1,8:1,11:1},
		1175:{1:1,4:1,10:1},
		1176:{5:1,8:1,10:1},
		1177:{6:1,9:1,11:1},
		1178:{2:1,6:1,9:1,11:1},
		1179:{2:1,5:1,7:1,10:1,12:1},
		1180:{1:1,10:1,12:1},
		1181:{2:1,7:1},
		1182:{1:1,3:1,5:1,7:1,10:1},
		1183:{3:1},
		1184:{4:1,7:1},
		1185:{5:1,8:1,10:1},
		1186:{1:1,5:1,8:1},
		1187:{1:1,6:1,9:1,13:1},
		1188:{4:1,6:1,9:1},
		1189:{1:1,4:1,10:1,12:1},
		1190:{2:1,4:1,7:1,9:1,11:1,13:1},
		1191:{2:1,6:1,9:1},
		1192:{3:1,9:1,12:1},
		1193:{4:1,7:1,9:1,13:1},
		1194:{4:1,7:1,12:1},
		1195:{5:1,8:1,12:1},
		1196:{4:1,6:1,9:1,13:1},
		1197:{3:1,9:1},
		1198:{3:1,6:1,10:1},
		1199:{3:1,5:1,8:1,10:1,12:1},
		1200:{8:1,11:1},
		1201:{1:1,3:1,6:1,8:1,12:1},
		1202:{3:1,6:1,11:1},
		1203:{4:1,7:1,11:1},
		1204:{3:1,5:1,8:1},
		1205:{2:1,8:1},
		1206:{2:1,9:1},
		1207:{2:1,5:1,7:1,9:1,11:1},
		1208:{5:1,10:1,12:1},
		1209:{5:1,13:1},
		1210:{2:1,5:1,7:1,10:1},
		1211:{1:1,3:1,6:1,10:1},
		1212:{2:1,4:1,7:1},
		1213:{4:1,7:1,10:1},
		1214:{1:1,2:1,8:1,11:1},
		1215:{2:1,5:1,7:1,9:1},
		1216:{4:1,7:1,9:1},
		1217:{7:1,12:1},
		1218:{4:1,6:1,9:1,12:1},
		1219:{2:1,5:1,9:1},
		1220:{1:1,3:1,6:1},
		1221:{3:1,6:1,9:1,12:1},
		1222:{1:1,4:1,7:1,10:1},
		1223:{1:1,8:1,11:1,13:1},
		1224:{6:1,8:1},
		1225:{1:1},
		1226:{1:1,3:1,8:1},
		1227:{4:1,6:1},
		1228:{2:1,5:1,12:1},
		1229:{2:1,5:1,8:1,11:1,12:1},
		1230:{3:1,6:1,9:1,11:1},
		1231:{7:1,10:1,12:1},
		1232:{3:1,7:1,10:1,12:1},
		1233:{3:1,6:1,11:1},
		1234:{1:1,3:1,6:1},
		1235:{1:1,3:1,5:1,8:1},
		1236:{4:1,8:1,11:1},
		1237:{4:1,7:1,10:1},
		1238:{5:1,8:1,10:1},
		1239:{6:1,9:1,11:1},
		1240:{2:1,6:1,9:1},
		1241:{2:1,5:1,7:1,10:1},
		1242:{2:1,11:1,13:1},
		1243:{2:1,7:1},
		1244:{1:1,3:1,5:1,7:1,10:1},
		1245:{3:1},
		1246:{4:1,7:1},
		1247:{5:1,8:1,10:1},
		1248:{1:1,5:1,8:1},
		1249:{1:1,4:1,6:1,9:1},
		1250:{1:1,5:1,10:1},
		1251:{1:1,4:1,7:1,10:1},
		1252:{2:1,4:1,9:1,11:1},
		1253:{1:1,7:1,10:1,12:1},
		1254:{1:1,3:1,6:1,9:1,12:1},
		1255:{4:1,7:1,9:1,13:1},
		1256:{4:1,7:1,12:1},
		1257:{3:1,5:1,8:1,12:1},
		1258:{4:1,6:1,9:1,13:1},
		1259:{3:1,9:1},
		1260:{3:1,6:1,8:1,10:1},
		1261:{6:1,9:1,11:1,13:1},
		1262:{8:1,11:1},
		1263:{1:1,6:1,8:1,11:-1},
		1264:{1:1,3:1,6:1,11:1},
		1265:{2:1,4:1,7:1,11:1},
		1266:{3:1,5:1,8:1},
		1267:{2:1,8:1},
		1268:{2:1,9:1},
		1269:{3:1,6:1,8:1,10:1},
		1270:{5:1,10:1},
		1271:{5:1},
		1272:{1:1,3:1,6:1,8:1,11:1},
		1273:{1:1,3:1,6:1,10:1},
		1274:{2:1,4:1,7:1,10:1},
		1275:{4:1,7:1,10:1},
		1276:{1:1,2:1,8:1,11:1},
		1277:{2:1,5:1,7:1,9:1},
		1278:{4:1,9:1},
		1279:{7:1,12:1},
		1280:{5:1,7:1,10:1,13:1},
		1281:{3:-1},
		1282:{13:1},
		1284:{12:-1},
		1287:{12:-1},
		1297:{10:-1},
		1300:{10:1,11:1},
		1307:{7:-1},
		1313:{6:-1,8:-1},
		1317:{2:1},
		1318:{12:-1},
		1319:{6:-1},
		1321:{7:-1},
		1324:{5:-1},
		1326:{11:-1},
		1330:{12:-1},
		1333:{7:-1},
		1335:{8:1},
		1337:{9:-1},
		1339:{10:-1},
		1344:{7:-1},
		1352:{8:-1},
		1353:{7:-1},
		1362:{6:-1},
		1364:{8:-1},
		1366:{9:-1},
		1371:{6:-1},
		1372:{7:-1},
		1373:{7:-1},
		1380:{12:-1},
		1381:{9:-1},
		1382:{7:-1},
		1388:{11:-1},
		1393:{5:-1},
		1397:{7:-1},
		1411:{3:-1},
		1414:{6:-1},
		1420:{10:-1},
		1421:{8:-1},
		1432:{1:1},
		1440:{9:-1},
		1442:{9:-1},
		1449:{11:-1},
		1458:{10:-1},
		1462:{12:1},
		1464:{13:1},
		1467:{7:-1},
		1475:{12:-1},
		1480:{3:-1},
		1481:{2:-1},
		1484:{7:-1},
		1490:{7:-1},
		1495:{7:-1},
		1496:{10:-1},
		1501:{6:-1},
		1508:{1:1},
		1513:{11:-1},
		1516:{11:1},
		1521:{10:-1},
		1526:{7:-1},
		1527:{7:-1},
		1535:{9:-1,11:1},
		1544:{5:-1},
		1546:{1:1,8:-1},
		1571:{8:-1},
		1572:{8:-1},
		1581:{11:1},
		1582:{7:-1},
		1588:{3:-1,4:-1},
		1589:{1:1},
		1591:{9:-1},
		1599:{1:1},
		1600:{2:-1},
		1612:{3:1},
		1616:{5:-1},
		1622:{7:-1},
		1627:{9:-1},
		1628:{1:1},
		1630:{4:1},
		1634:{8:-1},
		1643:{2:1},
		1649:{5:-1},
		1662:{2:-1},
		1673:{11:1},
		1685:{2:-1},
		1687:{3:-1},
		1694:{6:-1},
		1704:{11:1},
		1708:{2:-1},
		1720:{7:-1},
		1759:{3:-1},
		1778:{3:-1},
		1779:{7:-1},
		1787:{12:-1},
		1789:{7:-1},
		1796:{6:-1},
		1804:{8:-1},
		1831:{4:-1},
		1842:{1:-1},
		1863:{1:-1},
		1880:{11:1},
		1896:{2:-1},
		1914:{11:-1},
		1916:{2:-1},
		1920:{11:-1}
	};
    this.qiKB = [ //气直线拟合参数 使农历-720年至2300年与寿星万年历匹配
        1640650.479938, 15.21842500, //-221-11-09 h=0.01709 古历·秦汉
        1642476.703182, 15.21874996, //-216-11-09 h=0.01557 古历·秦汉
        1683430.515601, 15.218750011, //-104-12-25 h=0.01560 汉书·律历志(太初历)平气平朔 回归年=365.25000
        1752157.640664, 15.218749978, //85-02-23 h=0.01559 后汉书·律历志(四分历) 回归年=365.25000
        1807675.003759, 15.218620279, //237-02-22 h=0.00010 晋书·律历志(景初历) 回归年=365.24689
        1883627.765182, 15.218612292, //445-02-03 h=0.00026 宋书·律历志(何承天元嘉历) 回归年=365.24670
        1907369.128100, 15.218449176, //510-02-03 h=0.00027 宋书·律历志(祖冲之大明历) 回归年=365.24278
        1936603.140413, 15.218425000, //590-02-17 h=0.00149 随书·律历志(开皇历) 回归年=365.24220
        1939145.524180, 15.218466998, //597-02-03 h=0.00121 随书·律历志(大业历) 回归年=365.24321
        1947180.798300, 15.218524844, //619-02-03 h=0.00052 新唐书·历志(戊寅元历)平气定朔 回归年=365.24460
        1964362.041824, 15.218533526, //666-02-17 h=0.00059 新唐书·历志(麟德历) 回归年=365.24480
        1987372.340971, 15.218513908, //729-02-16 h=0.00096 新唐书·历志(大衍历,至德历) 回归年=365.24433
        1999653.819126, 15.218530782, //762-10-03 h=0.00093 新唐书·历志(五纪历) 回归年=365.24474
        2007445.469786, 15.218535181, //784-02-01 h=0.00059 新唐书·历志(正元历,观象历) 回归年=365.24484
        2021324.917146, 15.218526248, //822-02-01 h=0.00022 新唐书·历志(宣明历) 回归年=365.24463
        2047257.232342, 15.218519654, //893-01-31 h=0.00015 新唐书·历志(崇玄历) 回归年=365.24447
        2070282.898213, 15.218425000, //956-02-16 h=0.00149 旧五代·历志(钦天历) 回归年=365.24220
        2073204.872850, 15.218515221, //964-02-16 h=0.00166 宋史·律历志(应天历) 回归年=365.24437
        2080144.500926, 15.218530782, //983-02-16 h=0.00093 宋史·律历志(乾元历) 回归年=365.24474
        2086703.688963, 15.218523776, //1001-01-31 h=0.00067 宋史·律历志(仪天历,崇天历) 回归年=365.24457
        2110033.182763, 15.218425000, //1064-12-15 h=0.00669 宋史·律历志(明天历) 回归年=365.24220
        2111190.300888, 15.218425000, //1068-02-15 h=0.00149 宋史·律历志(崇天历) 回归年=365.24220
        2113731.271005, 15.218515671, //1075-01-30 h=0.00038 李锐补修(奉元历) 回归年=365.24438
        2120670.840263, 15.218425000, //1094-01-30 h=0.00149 宋史·律历志 回归年=365.24220
        2123973.309063, 15.218425000, //1103-02-14 h=0.00669 李锐补修(占天历) 回归年=365.24220
        2125068.997336, 15.218477932, //1106-02-14 h=0.00056 宋史·律历志(纪元历) 回归年=365.24347
        2136026.312633, 15.218472436, //1136-02-14 h=0.00088 宋史·律历志(统元历,乾道历,淳熙历) 回归年=365.24334
        2156099.495538, 15.218425000, //1191-01-29 h=0.00149 宋史·律历志(会元历) 回归年=365.24220
        2159021.324663, 15.218425000, //1199-01-29 h=0.00149 宋史·律历志(统天历) 回归年=365.24220
        2162308.575254, 15.218461742, //1208-01-30 h=0.00146 宋史·律历志(开禧历) 回归年=365.24308
        2178485.706538, 15.218425000, //1252-05-15 h=0.04606 淳祐历 回归年=365.24220
        2178759.662849, 15.218445786, //1253-02-13 h=0.00231 会天历 回归年=365.24270
        2185334.020800, 15.218425000, //1271-02-13 h=0.00520 宋史·律历志(成天历) 回归年=365.24220
        2187525.481425, 15.218425000, //1277-02-12 h=0.00520 本天历 回归年=365.24220
        2188621.191481, 15.218437494, //1280-02-13 h=0.00015 元史·历志(郭守敬授时历) 回归年=365.24250
        2322147.76 //1645-09-21
    ];
	this.suoKB = [ //朔直线拟合参数 使农历-720年至2300年与寿星万年历匹配
        1457698.231017, 29.53067166, //-721-12-17 h=0.00032 古历·春秋
        1546082.512234, 29.53085106, //-479-12-11 h=0.00053 古历·战国
        1640640.735300, 29.53060000, //-221-10-31 h=0.01010 古历·秦汉
        1642472.151543, 29.53085439, //-216-11-04 h=0.00040 古历·秦汉
        1683430.509300, 29.53086148, //-104-12-25 h=0.00313 汉书·律历志(太初历)平气平朔
        1752148.041079, 29.53085097, //85-02-13 h=0.00049 后汉书·律历志(四分历)
        1807724.481520, 29.53059851, //237-04-12 h=0.00033 晋书·律历志(景初历)
        1883618.114100, 29.53060000, //445-01-24 h=0.00030 宋书·律历志(何承天元嘉历)
        1907360.704700, 29.53060000, //510-01-26 h=0.00030 宋书·律历志(祖冲之大明历)
        1936596.224900, 29.53060000, //590-02-10 h=0.01010 随书·律历志(开皇历)
        1939135.675300, 29.53060000, //597-01-24 h=0.00890 随书·律历志(大业历)
        1947168.00 //619-01-21
    ];
    /**
     * 来源: https://locutus.io/php/
     */
    this.intval = function(mixedVar, base) {
        var tmp, match;

        var type = typeof mixedVar;

        if (type === 'boolean') {
            return +mixedVar;
        } else if (type === 'string') {
            if (base === 0) {
                match = mixedVar.match(/^\s*0(x?)/i);
                base = match ? (match[1] ? 16 : 8) : 10;
            }
            tmp = parseInt(mixedVar, base || 10);
            if (isNaN(tmp) || !isFinite(tmp)) {
                return 0;
            }
            return tmp;
        } else if (type === 'number' && isFinite(mixedVar)) {
            return mixedVar < 0 ? Math.ceil(mixedVar) : Math.floor(mixedVar);
        } else {
            return 0;
        }
    };
    /**
     * 来源: https://locutus.io/php/
     */
    this.floatval = function(mixedVar) {
        return (parseFloat(mixedVar) || 0);
    };
    /**
     * 来源: https://locutus.io/php/
     */
    this.boolval = function(mixedVar) {
        if (mixedVar === false) {
            return false;
        }
        if (mixedVar === 0 || mixedVar === 0.0) {
            return false;
        }
        if (mixedVar === '' || mixedVar === '0') {
            return false;
        }
        if (Array.isArray(mixedVar) && mixedVar.length === 0) {
            return false;
        }
        if (mixedVar === null || mixedVar === undefined) {
            return false;
        }
        return true;
    };
	/**
	 * 真太阳时模块,sn代表sin
	 */
	this.sn = function(x) {
		return Math.sin(x * 1.74532925199433E-02);
	};
	/**
	 * 真太阳时模块,cn代表cosine
	 */
	this.cn = function(x) {
		return Math.cos(x * 1.74532925199433E-02);
	};
	/**
	 * 真太阳时模块,返回小数部分(负数特殊) returns fractional part of a number
	 */
	this.fpart = function(x) {
		x = x - Math.floor(x);
		if (x < 0) {
			x = x + 1;
		}
		return x; //只取小数部份
	};
	/**
	 * 真太阳时模块,只取整数部份
	 */
	this.ipart = function(x) {
		if (x == 0) {
			return 0;
		}
		return (x / Math.abs(x)) * Math.floor(Math.abs(x));
	};
	/**
	 * 真太阳时模块,finds a parabola through three points and returns values of coordinates of extreme value (xe, ye) and zeros if any (z1, z2) assumes that the x values are -1, 0, +1
	 */
	this.quad = function(ym, y0, yp) {
		var nz = 0;
		var A = 0.5 * (ym + yp) - y0;
		var b = 0.5 * (yp - ym);
		var c = y0;
		var xe = -b / (2 * A); //x coord of symmetry line
		var ye = (A * xe + b) * xe + c; //extreme value for y in interval
		var dis = b * b - 4 * A * c; //discriminant
		if (dis > 0) { //there are zeros
			var dx = 0.5 * Math.sqrt(dis) / Math.abs(A);
			var z1 = xe - dx;
			var z2 = xe + dx;
			if (Math.abs(z1) <= 1) {
				nz = nz + 1;
			} //This zero is in interval
			if (Math.abs(z2) <= 1) {
				nz = nz + 1;
			} //This zero is in interval
			if (z1 < -1) {
				z1 = z2;
			}
		}
		return [xe, ye, z1, z2, nz];
	};
	/**
	 * 真太阳时模块,returns sine of the altitude of either the sun or the moon given the modified julian day of the UT
	 * @param float jd
	 * @param float J 经度,东经为正西经为负
	 * @param float W
	 * @param int LX 1月亮 2太阳日升日落 3太阳海上微光
	 */
	this.sinalt = function(jd, J, W, LX) {
		var instant = jd - 2400001;
		
		var t = (instant - 51544.5) / 36525; //减51544.5为相对2000年01月01日零点
		if (LX == 1) {
			var [ra, dec] = this.moon(t);
		} else {
			var [ra, dec] = this.sun(t);
		}

		var mjd0 = this.ipart(instant); //UT时间0点;returns the local sidereal time(计算观测地区的恒星时)开始
		var ut = (instant - mjd0) * 24;
		var t2 = (mjd0 - 51544.5) / 36525;
		var gmst = 6.697374558 + 1.0027379093 * ut;
		gmst = gmst + (8640184.812866 + (0.093104 - 0.0000062 * t2) * t2) * t2 / 3600;
		var lmst = 24 * this.fpart((gmst + J / 15) / 24); //结束

		var tau = 15 * (lmst - ra); //hour angle of object
		return this.sn(W) * this.sn(dec) + this.cn(W) * this.cn(dec) * this.cn(tau);
	};
	/**
	 * 真太阳时模块,关于太阳的,Returns RA and DEC of Sun to roughly 1 arcmin for few hundred years either side of J2000.0
	 */
	this.sun = function(t) {
		var p2 = 2 * Math.PI;
		var COSEPS = 0.91748;
		var SINEPS = 0.39778;
		var m = p2 * this.fpart(0.993133 + 99.997361 * t); //Mean anomaly
		var dL = 6893 * Math.sin(m) + 72 * Math.sin(2 * m); //Eq centre
		var L = p2 * this.fpart(0.7859453 + m / p2 + (6191.2 * t + dL) / 1296000);
		//convert to RA and DEC - ecliptic latitude of Sun taken as zero
		var sl = Math.sin(L);
		var x = Math.cos(L);
		var y = COSEPS * sl;
		var Z = SINEPS * sl;
		var rho = Math.sqrt(1 - Z * Z);
		var dec = (360 / p2) * Math.atan(Z / rho);
		var ra = (48 / p2) * Math.atan(y / (x + rho));
		if (ra < 0) {
			ra = ra + 24;
		}
		return [ra, dec];
	};
	/**
	 * 真太阳时模块,关于月球的,Returns RA and DEC of Moon to 5 arc min (ra) and 1 arc min (dec) for a few centuries either side of J2000.0
	 * Predicts rise and set times to within minutes for about 500 years in past - TDT and UT time diference may become significant for long times
	 */
	this.moon = function(t) {
		var p2 = 2 * Math.PI;
		var ARC = 206264.8062;
		var COSEPS = 0.91748;
		var SINEPS = 0.39778;
		var L0 = this.fpart(0.606433 + 1336.855225 * t); //mean long Moon in revs
		var L = p2 * this.fpart(0.374897 + 1325.55241 * t); //mean anomaly of Moon
		var LS = p2 * this.fpart(0.993133 + 99.997361 * t); //mean anomaly of Sun
		var d = p2 * this.fpart(0.827361 + 1236.853086 * t); //diff longitude sun and moon
		var F = p2 * this.fpart(0.259086 + 1342.227825 * t); //mean arg latitude
		//longitude correction terms
		var dL = 22640 * Math.sin(L) - 4586 * Math.sin(L - 2 * d);
		dL = dL + 2370 * Math.sin(2 * d) + 769 * Math.sin(2 * L);
		dL = dL - 668 * Math.sin(LS) - 412 * Math.sin(2 * F);
		dL = dL - 212 * Math.sin(2 * L - 2 * d) - 206 * Math.sin(L + LS - 2 * d);
		dL = dL + 192 * Math.sin(L + 2 * d) - 165 * Math.sin(LS - 2 * d);
		dL = dL - 125 * Math.sin(d) - 110 * Math.sin(L + LS);
		dL = dL + 148 * Math.sin(L - LS) - 55 * Math.sin(2 * F - 2 * d);
		//latitude arguments
		var S = F + (dL + 412 * Math.sin(2 * F) + 541 * Math.sin(LS)) / ARC;
		var h = F - 2 * d;
		//latitude correction terms
		var N = -526 * Math.sin(h) + 44 * Math.sin(L + h) - 31 * Math.sin(h - L) - 23 * Math.sin(LS + h);
		var N = N + 11 * Math.sin(h - LS) - 25 * Math.sin(F - 2 * L) + 21 * Math.sin(F - L);
		var lmoon = p2 * this.fpart(L0 + dL / 1296000); //Lat in rads
		var bmoon = (18520 * Math.sin(S) + N) / ARC; //long in rads
		//convert to equatorial coords using a fixed ecliptic
		var CB = Math.cos(bmoon);
		var x = CB * Math.cos(lmoon);
		var V = CB * Math.sin(lmoon);
		var C = Math.sin(bmoon);
		var y = COSEPS * V - SINEPS * C;
		var Z = SINEPS * V + COSEPS * C;
		var rho = Math.sqrt(1 - Z * Z);
		var dec = (360 / p2) * Math.atan(Z / rho); //算出月球的视赤纬(apparent declination)
		var ra = (48 / p2) * Math.atan(y / (x + rho)); //算出月球的视赤经(apparent right ascension)
		if (ra < 0) {
			ra = ra + 24;
		}
		return [ra, dec];
	};
	/**
	 * 真太阳时模块,rise and set(升降计算) [升起时刻(真太阳时),落下时刻(真太阳时),真平太阳时差(仅类型2),升起时刻(标准时间,仅类型2),落下时刻(标准时间,仅类型2)]
	 * @param float jd
	 * @param float J 经度,东经为正西经为负
	 * @param float W
	 * @param int LX 类型:1月亮;2太阳日升日落;3太阳海上微光
	 * @return array
	 */
	this.risenset = function(jd, J, W, LX) {
		var jd = this.floatval(jd);
		var J = +1 * this.floatval(J); //统一东经为正
		var W = +1 * this.floatval(W); //北纬为正,南纬为负
		
		var noon = Math.round(jd) - this.J / 360; //儒略日,中午12点,減去8小時時差

		var sinho = new Array(3); //太阳盘面几何中心与理想地平面之间的夹角
		sinho[1] = this.sn(8 / 60); //moonrise - average diameter used(月亮升降)
		sinho[2] = this.sn(-50 / 60); //sunrise - classic value for refraction(太阳升降)
		sinho[3] = this.sn(-12); //nautical twilight(海上微光)
		
		var rise = 0; //是否有升起动作
		var utrise = false; //升起的时间
		
		var sett = 0; //是否有落下动作
		var utset = false; //落下的时间

		var hour = 1;
		var zero2 = 0; //两小时内是否进行了升起和落下两个动作(极地附近有这种情况,如1999年12月25日,经度0,纬度67.43,当天的太阳只有8分钟-_-)

		var ym = this.sinalt(noon + (hour - 1)/24, J, W, LX) - sinho[LX]; //See STEP 1 and 2 of Web page description.
		if (ym > 0) { //used later to classify non-risings 是否在地平线上方,用于判断极昼极夜
			var above = 1;
		} else {
			var above = 0;
		}

		do {
			//STEP 1 and STEP 3 of Web page description
			var y0 = this.sinalt(noon + (hour + 0)/24, J, W, LX) - sinho[LX];
			var yp = this.sinalt(noon + (hour + 1)/24, J, W, LX) - sinho[LX];
			//STEP 4 of web page description
			var [xe, ye, z1, z2, nz] = this.quad(ym, y0, yp);
			switch (nz) { //cases depend on values of discriminant - inner part of STEP 4
				case 0: //nothing  - go to next time slot
				break; 
				case 1: //simple rise / set event
					if (ym < 0) { //must be a rising event
						utrise = hour + z1;
						rise = 1;
					} else { //must be setting
						utset = hour + z1;
						sett = 1;
					}
				break;
				case 2: //rises and sets within interval
					if (ye < 0) { //minimum - so set then rise
						utrise = hour + z2;
						utset = hour + z1;
					} else { //maximum - so rise then set
						utrise = hour + z1;
						utset = hour + z2;
					}
					rise = 1;
					sett = 1;
					zero2 = 1;
				break;
			}
			ym = yp; //reuse the ordinate in the next interval
			hour = hour + 2;
		} while (!((hour == 25) || (rise * sett == 1))); //STEP 5 of Web page description - have we finished for this object?
		
		if(utset !== false){ //注意这里转成了真太阳时
			utset = Math.round(jd) - 0.5 + utset/24 - (this.J - J) * 4 / 60 / 24;
		}
		if(utrise !== false){
			utrise = Math.round(jd) - 0.5 + utrise/24 - (this.J - J) * 4 / 60 / 24;
		}

		var dt = 0; //地方平太阳时 减 真太阳时 的差值,即"真平太阳时差换算表",单位为天
		var tset = (LX == 2) ? utset : 0; //用于返回标准时间,关于月亮的必须先通过太阳升降获取到dt再转标准时间
		var trise = (LX == 2) ? utrise : 0;
		if((LX == 2) && (rise * sett == 1)){ //太阳相关,非极昼极夜且有升有落
			while(tset < trise){ //太阳先落下再升起,时区与经度不匹配的情况下会出现此种情况,加一天修正
				tset += 1;
			}
			dt = Math.round(jd) - (trise + (tset - trise) / 2); //单位为天.比较两者的中午12点(上午和下午是对称的)
			
			tset = tset - dt + (this.J - J) * 4 / 60 / 24; //真太阳时转标准时间
			trise = trise - dt + (this.J - J) * 4 / 60 / 24;
		}

		return [utrise, utset, dt, trise, tset];
	};
	/**
	 * 真太阳时模块,改编自 https://bieyu.com/ (月亮與太陽出没時間) 原理:用天文方法计算出太阳升起和落下时刻,中间则为当地正午(自创),与12点比较得到时差;与寿星万年历比较,两者相差在20秒内
	 * @param float jd
	 * @param float J 经度,东经为正西经为负,注意西经60度38分转换方式是: -60 + -1 * 38/60
	 * @param float W 纬度,北纬为正南纬为负,太阳并不是严格从正东方升起,所以纬度也有影响,只是相对影响较小
	 */
	this.zty = function(jd, J, W) {
		var jd = this.floatval(jd);
		var J = (J === undefined) ? this.J : this.floatval(J);
		var W = (W === undefined) ? this.W : this.floatval(W);
		
		var [utrise, utset, dt, trise, tset] = this.risenset(jd, J, W, 2);
		
		return jd - (this.J - J) * 4 / 60 / 24 + dt; //转地方平太阳时+修正
	};
    /**
     * 將公历時间轉换爲儒略日
     * @param int yy(-1000-3000)
     * @param int mm(1-12)
     * @param int dd(1-31)
     * @param int hh(0-23)
     * @param int mt(0-59)
     * @param int ss(0-59)
     * @return false|number
     */
    this.Jdays = function(yy, mm, dd, hh, mt, ss) {
        var yy = this.floatval(yy);
        var mm = this.floatval(mm);
        var dd = this.floatval(dd);
        var hh = (hh === undefined) ? 12 : this.floatval(hh);
        var mt = (mt === undefined) ? 0 : this.floatval(mt);
        var ss = (ss === undefined) ? 0 : this.floatval(ss);

        var yp = yy + Math.floor((mm - 3) / 10);
        if ((yy > 1582) || (yy == 1582 && mm > 10) || (yy == 1582 && mm == 10 && dd >= 15)) {
            var init = 1721119.5;
            var jdy = Math.floor(yp * 365.25) - Math.floor(yp / 100) + Math.floor(yp / 400);
        } else {
            if ((yy < 1582) || (yy == 1582 && mm < 10) || (yy == 1582 && mm == 10 && dd <= 4)) {
                var init = 1721117.5;
                var jdy = Math.floor(yp * 365.25);
            } else { //不存在的时间
                return false;
            }
        }
        var mp = Math.floor(mm + 9) % 12;
        var jdm = mp * 30 + Math.floor((mp + 1) * 34 / 57);
        var jdd = dd - 1;
        hh = hh + ((ss / 60) + mt) / 60;
        var jdh = hh / 24;
        return jdy + jdm + jdd + jdh + init;
    };
    /**
     * 將儒略日轉换爲公历(即陽曆或格里曆)年月日時分秒 [年,月,日,时,分,秒]
     * @param float jd
     * @return array
     */
    this.Jtime = function(jd) {
        var jd = this.floatval(jd);
        if (jd >= 2299160.5) { //以1582年的10月15日0時(JD值2299160.5)為分界點,在這之前為儒略曆,之後為格里曆
            var y4h = 146097;
            var init = 1721119.5;
        } else {
            var y4h = 146100;
            var init = 1721117.5;
        }
        var jdr = Math.floor(jd - init);
        var yh = y4h / 4;
        var cen = Math.floor((jdr + 0.75) / yh);
        var d = Math.floor(jdr + 0.75 - cen * yh);
        var ywl = 1461 / 4;
        var jy = Math.floor((d + 0.75) / ywl);
        d = Math.floor(d + 0.75 - ywl * jy + 1);
        var ml = 153 / 5;
        var mp = Math.floor((d - 0.5) / ml);
        d = Math.floor((d - 0.5) - 30.6 * mp + 1);
        var y = (100 * cen) + jy;
        var m = (mp + 2) % 12 + 1;
        if (m < 3) {
            y = y + 1;
        }
        var sd = Math.floor((jd + 0.5 - Math.floor(jd + 0.5)) * 24 * 60 * 60 + 0.00005);
        var mt = Math.floor(sd / 60);
        var ss = sd % 60;
        var hh = Math.floor(mt / 60);
        var mt = mt % 60;
        var yy = Math.floor(y);
        var mm = Math.floor(m);
        var dd = Math.floor(d);

        return [yy, mm, dd, hh, mt, ss];
    };
    /**
     * 驗證公历日期是否有效
     * @param int yy(-1000-3000)
     * @param int mm(1-12)
     * @param int dd(1-31)
     * @return boolean
     */
    this.ValidDate = function(yy, mm, dd) {
        var vd = true;
        if (mm <= 0 || mm > 12) { //月份超出範圍
            vd = false;
        } else {
            var ndf1 = -(yy % 4 == 0); //可被四整除
            var ndf2 = ((yy % 400 == 0) - (yy % 100 == 0)) && (yy > 1582);
            var ndf = ndf1 + ndf2;
            var dom = 30 + ((Math.abs(mm - 7.5) + 0.5) % 2) - (mm == 2) * (2 + ndf);
            if (dd <= 0 || dd > dom) {
                if (ndf == 0 && mm == 2 && dd == 29) { //此年無閏月
                   
                } else { //日期超出範圍

                }
                vd = false;
            }
        }
        if (yy == 1582 && mm == 10 && dd >= 5 && dd < 15) { //此日期不存在
            vd = false;
        }
        return vd;
    };
    /**
     * 计算指定年(公历)的春分点(vernal equinox)理论值
     * 因地球在繞日运行時會因受到其他星球之影響而產生攝動(perturbation),必須將此現象產生的偏移量加入.
     * @param int yy
     * @return false|number 返回儒略日历时间
     */
    this.VE = function(yy) {
        var yx = this.intval(yy);
        if (yx >= 1000 && yx <= 8001) {
            var m = (yx - 2000) / 1000;
            var jdve = 2451623.80984 + 365242.37404 * m + 0.05169 * m * m - 0.00411 * m * m * m - 0.00057 * m * m * m * m;
        } else {
            if (yx >= -8000 && yx < 1000) {
                var m = yx / 1000;
                var jdve = 1721139.29189 + 365242.1374 * m + 0.06134 * m * m + 0.00111 * m * m * m - 0.00071 * m * m * m * m;
            } else { //超出计算能力范围
                return false;
            }
        }
        return jdve;
    };
    /**
     * 获取指定公历年的春分开始的24节气理论值
     * 大致原理是:把公转轨道进行24等分,每一等分为一个节气,此为理论值,再用摄动值(Perturbation)和固定参数DeltaT做调整得到实际值
     * @param int yy
     * @return array 下标从0开始的数组
     */
    this.MeanJQJD = function(yy) {
        var yy = this.intval(yy);

        var jdez = [];
        var jdve = this.VE(yy);
        var ty = this.VE(yy + 1) - jdve; //求指定年的春分點及回歸年長

        var ath = 2 * Math.PI / 24;
        var tx = (jdve - 2451545) / 365250;
        var e = 0.0167086342 - 0.0004203654 * tx - 0.0000126734 * tx * tx + 0.0000001444 * tx * tx * tx - 0.0000000002 * tx * tx * tx * tx + 0.0000000003 * tx * tx * tx * tx * tx;
        var tt = yy / 1000;
        var vp = 111.25586939 - 17.0119934518333 * tt - 0.044091890166673 * tt * tt - 4.37356166661345E-04 * tt * tt * tt + 8.16716666602386E-06 * tt * tt * tt * tt;
        var rvp = vp * 2 * Math.PI / 360;
        var peri = [];
        for (var i = 1; i <= 24; i++) {
            var flag = 0;
            var th = ath * (i - 1) + rvp;
            if (th > Math.PI && th <= 3 * Math.PI) {
                th = 2 * Math.PI - th;
                flag = 1;
            }
            if (th > 3 * Math.PI) {
                th = 4 * Math.PI - th;
                flag = 2;
            }
            var f1 = 2 * Math.atan((Math.sqrt((1 - e) / (1 + e)) * Math.tan(th / 2)));
            var f2 = (e * Math.sqrt(1 - e * e) * Math.sin(th)) / (1 + e * Math.cos(th));
            var f = (f1 - f2) * ty / 2 / Math.PI;
            if (flag == 1) {
                f = ty - f;
            }
            if (flag == 2) {
                f = 2 * ty - f;
            }
            peri[i] = f;
        }
        for (var i = 1; i <= 24; i++) {
            jdez[i - 1] = jdve + peri[i] - peri[1];
        }
        return jdez;
    };
    /**
     * 地球在繞日运行時會因受到其他星球之影響而產生攝動(perturbation)
     * @param float jdez Julian day
     * @return number 返回某时刻(儒略日历)的攝動偏移量
     */
    this.Perturbation = function(jdez) {
        var jdez = this.floatval(jdez);
        var ptsa = [485, 203, 199, 182, 156, 136, 77, 74, 70, 58, 52, 50, 45, 44, 29, 18, 17, 16, 14, 12, 12, 12, 9, 8];
        var ptsb = [324.96, 337.23, 342.08, 27.85, 73.14, 171.52, 222.54, 296.72, 243.58, 119.81, 297.17, 21.02, 247.54, 325.15, 60.93, 155.12, 288.79, 198.04, 199.76, 95.39, 287.11, 320.81, 227.73, 15.45];
        var ptsc = [1934.136, 32964.467, 20.186, 445267.112, 45036.886, 22518.443, 65928.934, 3034.906, 9037.513, 33718.147, 150.678, 2281.226, 29929.562, 31555.956, 4443.417, 67555.328, 4562.452, 62894.029, 31436.921, 14577.848, 31931.756, 34777.259, 1222.114, 16859.074];
        var t = (jdez - 2451545) / 36525;
        var s = 0;
        for (var k = 0; k <= 23; k++) {
            s = s + ptsa[k] * Math.cos(ptsb[k] * 2 * Math.PI / 360 + ptsc[k] * 2 * Math.PI / 360 * t);
        }
        var w = 35999.373 * t - 2.47;
        var l = 1 + 0.0334 * Math.cos(w * 2 * Math.PI / 360) + 0.0007 * Math.cos(2 * w * 2 * Math.PI / 360);
        return 0.00001 * s / l;
    };
    /**
     * 求∆t
     * @param int yy 公历年份
     * @param int mm 公历月份,可能为负数
     * @return number 单位为分钟
     */
    this.DeltaT = function(yy, mm) {
        var yy = this.intval(yy);
        var mm = this.intval(mm);

        var u, t, dt, y;
        y = yy + (mm - 0.5) / 12;
        if (y <= -500) {
            u = (y - 1820) / 100;
            dt = (-20 + 32 * u * u);
        } else {
            if (y < 500) {
                u = y / 100;
                dt = (10583.6 - 1014.41 * u + 33.78311 * u * u - 5.952053 * u * u * u - 0.1798452 * u * u * u * u + 0.022174192 * u * u * u * u * u + 0.0090316521 * u * u * u * u * u * u);
            } else {
                if (y < 1600) {
                    u = (y - 1000) / 100;
                    dt = (1574.2 - 556.01 * u + 71.23472 * u * u + 0.319781 * u * u * u - 0.8503463 * u * u * u * u - 0.005050998 * u * u * u * u * u + 0.0083572073 * u * u * u * u * u * u);
                } else {
                    if (y < 1700) {
                        t = y - 1600;
                        dt = (120 - 0.9808 * t - 0.01532 * t * t + t * t * t / 7129);
                    } else {
                        if (y < 1800) {
                            t = y - 1700;
                            dt = (8.83 + 0.1603 * t - 0.0059285 * t * t + 0.00013336 * t * t * t - t * t * t * t / 1174000);
                        } else {
                            if (y < 1860) {
                                t = y - 1800;
                                dt = (13.72 - 0.332447 * t + 0.0068612 * t * t + 0.0041116 * t * t * t - 0.00037436 * t * t * t * t + 0.0000121272 * t * t * t * t * t - 0.0000001699 * t * t * t * t * t * t + 0.000000000875 * t * t * t * t * t * t * t);
                            } else {
                                if (y < 1900) {
                                    t = y - 1860;
                                    dt = (7.62 + 0.5737 * t - 0.251754 * t * t + 0.01680668 * t * t * t - 0.0004473624 * t * t * t * t + t * t * t * t * t / 233174);
                                } else {
                                    if (y < 1920) {
                                        t = y - 1900;
                                        dt = (-2.79 + 1.494119 * t - 0.0598939 * t * t + 0.0061966 * t * t * t - 0.000197 * t * t * t * t);
                                    } else {
                                        if (y < 1941) {
                                            t = y - 1920;
                                            dt = (21.2 + 0.84493 * t - 0.0761 * t * t + 0.0020936 * t * t * t);
                                        } else {
                                            if (y < 1961) {
                                                t = y - 1950;
                                                dt = (29.07 + 0.407 * t - t * t / 233 + t * t * t / 2547);
                                            } else {
                                                if (y < 1986) {
                                                    t = y - 1975;
                                                    dt = (45.45 + 1.067 * t - t * t / 260 - t * t * t / 718);
                                                } else {
                                                    if (y < 2005) {
                                                        t = y - 2000;
                                                        dt = (63.86 + 0.3345 * t - 0.060374 * t * t + 0.0017275 * t * t * t + 0.000651814 * t * t * t * t + 0.00002373599 * t * t * t * t * t);
                                                    } else {
                                                        if (y < 2050) {
                                                            t = y - 2000;
                                                            dt = (62.92 + 0.32217 * t + 0.005589 * t * t);
                                                        } else {
                                                            if (y < 2150) {
                                                                u = (y - 1820) / 100;
                                                                dt = (-20 + 32 * u * u - 0.5628 * (2150 - y));
                                                            } else {
                                                                u = (y - 1820) / 100;
                                                                dt = (-20 + 32 * u * u);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        if (y < 1955 || y >= 2005) {
            dt = dt - (0.000012932 * (y - 1955) * (y - 1955));
        }
        return dt / 60; //將秒轉換為分
    };
    /**
     * 获取指定公历年對Perturbaton作調整後的自春分點開始的24節氣,1645年农历七月及之前为<授时历>,八月开始启用传教士汤若望的<时宪历>,与现代天文算法存在误差,此处依据寿星万年历进行修正
     * @param int yy(-1000-3000)
	 * @param bool calendar 是否根据黄历进行调整,调整后精度为日(仅用于农历计算)
     * @return array this.jq[i%24]
     */
    this.GetAdjustedJQ = function(yy, calendar) {
        var yy = this.intval(yy);
		var calendar = calendar ? 1 : 0;
		
        if(this.JQ[yy] == undefined){
            this.JQ[yy] = [];
        }
		if(this.JQ[yy][0] == undefined){ //必须要有0
			var jdjq = [];
			var jdez = this.MeanJQJD(yy); //輸入指定年,求該回歸年各節氣点
			for (var i = 0; i < 24; i++) {
				var ptb = this.Perturbation(jdez[i]); //取得受perturbation影響所需微調
				var dt = this.DeltaT(yy, Math.ceil(i / 2) + 3); //修正dynamical time to Universal time
				jdjq[i] = jdez[i] + ptb - dt / 60 / 24; //加上攝動調整值ptb得到動態時間dynamical time or ephemeris days,減去對應的Delta T值(分鐘轉換為日)得到True Universal time
				jdjq[i] = jdjq[i] + 8 / 24; //因中國時間比格林威治時間先行8小時,即1/3日(由于农历基于此数据,此处必须为北京时间)
			}
			this.JQ[yy][0] = jdjq;
		}
		if(this.JQ[yy][calendar]){ //如果是0此处必返回
            return this.JQ[yy][calendar].slice(0);
        }
        
		var refer = true; //reference 如果无需修正则1直接引用0的
		var jdjq = this.JQ[yy][0].slice(0); //打破引用
		if(calendar == 1){ //古代农历模块完全来自寿星万年历
			var B = this.qiKB; //气直线拟合参数
			var pc = 7; //两气之间15天左右,7为中间偏一点以便找到最近的
			var f1 = B[0] - pc; //1640650.479938 - 7, -221-11-09 h=0.01709 古历·秦汉开始至没有天文算法(定气定朔)之前,古人采取平气平朔的方法,各朝代改动较大,许老师从繁杂的古历中提取数据进行分析而得到算法,致敬!
			var	f2 = B[B.length - 1] - pc; //1645-09-21 - 7 这之后采取徐光启与传教士汤若望合著的时宪历法,与现代天文算法仅存在最多上下一天的误差,所以简单采取修正表修正
			var	f3 = 2436935; //1960年01月01日12時00分00秒,这之后采取现代天文算法
			if (((jdjq[0] >= f1) && (jdjq[0] < f2)) || ((jdjq[23] >= f1) && (jdjq[23] < f2))) { //处于平气计算区间
				refer = false; //标志不能进行引用
				for(var i = 0,j = 0; j < 24; j++){ //逐个进行修正
					if((jdjq[j] < f1) || (jdjq[j] >= f2)){ //此时刻不在计算区间
						continue;
					}
					if(jdjq[j] + pc >= B[i + 2]){ //跨越了不同的历法
						for (; i < B.length; i += 2) {
							if (jdjq[j] + pc < B[i + 2]) {
								break;
							}
						}
					}
					
					jdjq[j] = B[i] + B[i + 1] * Math.floor((jdjq[j] + pc - B[i]) / B[i + 1]);
					jdjq[j] = Math.floor(jdjq[j] + 0.5);
					if (jdjq[j] == 1683460) {
						jdjq[j]++; //如果使用太初历计算-103年1月24日的朔日,结果得到的是23日,这里修正为24日(实历).修正后仍不影响-103的无中置闰.如果使用秦汉历,得到的是24日,本行D不会被执行.
					}
				}
			}
			for(var i in this.jqXFu[yy]){ //时宪历修正表,上面平气跑出来的不会来这里
				refer = false; //标志不能进行引用
				jdjq[i] += this.jqXFu[yy][i];
				jdjq[i] = Math.floor(jdjq[i] + 0.5); //修正后精度为日
			}
		}

		this.JQ[yy][calendar] = refer ? this.JQ[yy][0] : jdjq;
        
		return jdjq;
    };
    /**
     * 對於指定日期時刻所屬的朔望月,求出其均值新月點的月序數或时刻
     * @param float jd
	 * @param bool return_k 是否仅返回月序数
     * @return int/float
     */
    this.MeanNewMoon = function(jd, return_k) {
        var jd = this.floatval(jd);

        //k為從2000年1月6日14時20分36秒起至指定年月日之陰曆月數,以synodic month為單位
        var k = Math.floor((jd - 2451550.09765) / this.synmonth); //2451550.09765為2000年1月6日14時20分36秒之JD值,此為2000年後的第一個均值新月
		if(return_k){
			return k;
		}
        var jdt = 2451550.09765 + k * this.synmonth;
        //Time in Julian centuries from 2000 January 0.5.
        var t = (jdt - 2451545) / 36525; //以100年為單位,以2000年1月1日12時為0點
        var pt = jdt + 0.0001337 * t * t - 0.00000015 * t * t * t + 0.00000000073 * t * t * t * t; //mean time of phase

        return pt;
    };
    /**
     * 求出實際新月點.以2000年初的第一個均值新月點為0點求出的均值新月點和其朔望月之序數k代入此副程式來求算實際新月點
     * @param float jd 
	 * @param bool calendar 是否根据黄历进行调整,调整后精度为日(仅用于农历计算)
     * @return number
     */
    this.TrueNewMoon = function(jd, calendar) {
        var jd = this.floatval(jd);
		var calendar = calendar ? 1 : 0;
		
		if(calendar == 1){ //先判断是否需要进行朔直线拟合
			var B = this.suoKB; //朔直线拟合参数
			var pc = 14; //两朔之间30天左右
			var f1 = B[0] - pc; //1457698.231017 - 7, -721-12-17 h=0.00032
			var	f2 = B[B.length - 1] - pc; //1947168.00 - 7, 619-01-21 古人很早就知道用天文算法进行定朔了
			var	f3 = 2436935; //1960年01月01日12時00分00秒,这之后采取现代天文算法
			if ((jd >= f1) && (jd < f2)) { //处于平朔计算区间
				for (var i = 0; i < B.length; i += 2) {
					if (jd + pc < B[i + 2]) {
						break;
					}
				}
				var jdt = B[i] + B[i + 1] * Math.floor((jd + pc - B[i]) / B[i + 1]);
				jdt = Math.floor(jdt + 0.5);
				if (jdt == 1683460) {
					jdt++; //如果使用太初历计算-103年1月24日的朔日,结果得到的是23日,这里修正为24日(实历).修正后仍不影响-103的无中置闰.如果使用秦汉历,得到的是24日,本行D不会被执行.
				}	
				
				return jdt;
			}
		}
		
		var k = this.MeanNewMoon(jd, true); //+ 0,0.25,0.5,0.75分別對應新月,上弦月,滿月,下弦月
        var jdt = 2451550.09765 + k * this.synmonth;
        var t = (jdt - 2451545) / 36525; //2451545為2000年1月1日正午12時的JD
        var t2 = t * t; //square for frequent use
        var t3 = t2 * t; //cube for frequent use
        var t4 = t3 * t; //to the fourth
        //mean time of phase
        var pt = jdt + 0.0001337 * t2 - 0.00000015 * t3 + 0.00000000073 * t4;
        //Sun's mean anomaly(地球繞太陽運行均值近點角)(從太陽觀察)
        var m = 2.5534 + 29.10535669 * k - 0.0000218 * t2 - 0.00000011 * t3;
        //Moon's mean anomaly(月球繞地球運行均值近點角)(從地球觀察)
        var mprime = 201.5643 + 385.81693528 * k + 0.0107438 * t2 + 0.00001239 * t3 - 0.000000058 * t4;
        //Moon's argument of latitude(月球的緯度參數)
        var f = 160.7108 + 390.67050274 * k - 0.0016341 * t2 - 0.00000227 * t3 + 0.000000011 * t4;
        //Longitude of the ascending node of the lunar orbit(月球繞日運行軌道升交點之經度)
        var omega = 124.7746 - 1.5637558 * k + 0.0020691 * t2 + 0.00000215 * t3;
        //乘式因子
        var es = 1 - 0.002516 * t - 0.0000074 * t2;
        //因perturbation造成的偏移
        var apt1 = -0.4072 * Math.sin((Math.PI / 180) * mprime);
        apt1 += 0.17241 * es * Math.sin((Math.PI / 180) * m);
        apt1 += 0.01608 * Math.sin((Math.PI / 180) * 2 * mprime);
        apt1 += 0.01039 * Math.sin((Math.PI / 180) * 2 * f);
        apt1 += 0.00739 * es * Math.sin((Math.PI / 180) * (mprime - m));
        apt1 -= 0.00514 * es * Math.sin((Math.PI / 180) * (mprime + m));
        apt1 += 0.00208 * es * es * Math.sin((Math.PI / 180) * (2 * m));
        apt1 -= 0.00111 * Math.sin((Math.PI / 180) * (mprime - 2 * f));
        apt1 -= 0.00057 * Math.sin((Math.PI / 180) * (mprime + 2 * f));
        apt1 += 0.00056 * es * Math.sin((Math.PI / 180) * (2 * mprime + m));
        apt1 -= 0.00042 * Math.sin((Math.PI / 180) * 3 * mprime);
        apt1 += 0.00042 * es * Math.sin((Math.PI / 180) * (m + 2 * f));
        apt1 += 0.00038 * es * Math.sin((Math.PI / 180) * (m - 2 * f));
        apt1 -= 0.00024 * es * Math.sin((Math.PI / 180) * (2 * mprime - m));
        apt1 -= 0.00017 * Math.sin((Math.PI / 180) * omega);
        apt1 -= 0.00007 * Math.sin((Math.PI / 180) * (mprime + 2 * m));
        apt1 += 0.00004 * Math.sin((Math.PI / 180) * (2 * mprime - 2 * f));
        apt1 += 0.00004 * Math.sin((Math.PI / 180) * (3 * m));
        apt1 += 0.00003 * Math.sin((Math.PI / 180) * (mprime + m - 2 * f));
        apt1 += 0.00003 * Math.sin((Math.PI / 180) * (2 * mprime + 2 * f));
        apt1 -= 0.00003 * Math.sin((Math.PI / 180) * (mprime + m + 2 * f));
        apt1 += 0.00003 * Math.sin((Math.PI / 180) * (mprime - m + 2 * f));
        apt1 -= 0.00002 * Math.sin((Math.PI / 180) * (mprime - m - 2 * f));
        apt1 -= 0.00002 * Math.sin((Math.PI / 180) * (3 * mprime + m));
        apt1 += 0.00002 * Math.sin((Math.PI / 180) * (4 * mprime));
        
		var apt2 = 0.000325 * Math.sin((Math.PI / 180) * (299.77 + 0.107408 * k - 0.009173 * t2));
        apt2 += 0.000165 * Math.sin((Math.PI / 180) * (251.88 + 0.016321 * k));
        apt2 += 0.000164 * Math.sin((Math.PI / 180) * (251.83 + 26.651886 * k));
        apt2 += 0.000126 * Math.sin((Math.PI / 180) * (349.42 + 36.412478 * k));
        apt2 += 0.00011 * Math.sin((Math.PI / 180) * (84.66 + 18.206239 * k));
        apt2 += 0.000062 * Math.sin((Math.PI / 180) * (141.74 + 53.303771 * k));
        apt2 += 0.00006 * Math.sin((Math.PI / 180) * (207.14 + 2.453732 * k));
        apt2 += 0.000056 * Math.sin((Math.PI / 180) * (154.84 + 7.30686 * k));
        apt2 += 0.000047 * Math.sin((Math.PI / 180) * (34.52 + 27.261239 * k));
        apt2 += 0.000042 * Math.sin((Math.PI / 180) * (207.19 + 0.121824 * k));
        apt2 += 0.00004 * Math.sin((Math.PI / 180) * (291.34 + 1.844379 * k));
        apt2 += 0.000037 * Math.sin((Math.PI / 180) * (161.72 + 24.198154 * k));
        apt2 += 0.000035 * Math.sin((Math.PI / 180) * (239.56 + 25.513099 * k));
        apt2 += 0.000023 * Math.sin((Math.PI / 180) * (331.55 + 3.592518 * k));
        
		jdt = pt + apt1 + apt2;
		var [yy, mm, dd] = this.Jtime(jdt);
		jdt = jdt - this.DeltaT(yy, mm) / 1440; //修正dynamical time to Universal time
		jdt = jdt + 8 / 24; //因中國比格林威治先行8小時,加1/3天
		
		if(calendar && this.smXFu[yy]){ //下面进行查表修正
			var jd = this.Jdays(yy, 1, 1, 0, 0, 0); //算<=当年的那个朔望日
			var k2 = this.MeanNewMoon(jd, true);
			var n = k - k2; //当年第几个朔望日,用作校准的下标
			if(this.smXFu[yy][n]){
				jdt += this.smXFu[yy][n];
				jdt = Math.floor(jdt + 0.5); //修正后精度为日
			}
		}

		return jdt;
    };
    /**
     * 以比較日期法求算冬月及其餘各月名稱代碼,包含閏月,冬月為0,臘月為1,正月為2,餘類推.閏月多加0.5 [各月名稱, 含冬至連續16個新月點]
     * @param int yy(-1000-3000)
	 * @return array
     */
    this.GetZQandSMandLunarMonthCode = function(yy) {
        var yy = this.intval(yy);
		
		if(this.MC[yy] && this.SM[yy]){
            return [this.MC[yy].slice(0), this.SM[yy].slice(0)];
        }
		
		var mc = []; //名称 MingCheng
		var sjd = []; //shuo jd
		var qjd = []; //qi jd

		for(var i = -1,k = 0; i <= 1; i++){ //取得以前一年冬至為起點之連續16個中氣 qi jd
			var jq = this.GetAdjustedJQ(yy + i, true);
			for(var j = 0; j <= 22; j += 2, k++){
				if(k >= 9 && k <= 24){
					qjd[k - 9] = jq[j];
				}
			}
		}

		var jd = qjd[0] - 2 * this.synmonth - 14; //冬至之前的29天起算,兼顾1/3时差及修正,加14则兼顾步长
		for(var i = 0; i < 15; ){
			jd = this.TrueNewMoon(jd + this.synmonth + 14, true);
			if(Math.floor(jd + 0.5) > Math.floor(qjd[0] + 0.5)){
				i++;
			}
			sjd[i] = jd;
		}

        var yz = 0; //設定旗標,0表示未遇到閏月,1表示已遇到閏月
        mc[0] = 0;
        if (Math.floor(qjd[12] + 0.5) >= Math.floor(sjd[13] + 0.5)) { //若第13個中氣jdzq(12)大於或等於第14個新月jdnm(13)
            for (var i = 1; i <= 14; i++) { //表示此兩個冬至之間的11個中氣要放到12個朔望月中,
                //至少有一個朔望月不含中氣,第一個不含中氣的月即為閏月
                //若陰曆臘月起始日大於冬至中氣日,且陰曆正月起始日小於或等於大寒中氣日,則此月為閏月,其餘同理
                if (Math.floor((sjd[i] + 0.5) > Math.floor(qjd[i - 1 - yz] + 0.5) && Math.floor(sjd[i + 1] + 0.5) <= Math.floor(qjd[i - yz] + 0.5))) {
                    mc[i] = i - 0.5;
                    yz = 1; //標示遇到閏月
                } else {
                    mc[i] = i - yz; //遇到閏月開始,每個月號要減1
                }
            }
        } else { //否則表示兩個連續冬至之間只有11個整月,故無閏月
            for (var i = 1; i <= 12; i++) { //直接賦予這12個月月代碼
                mc[i] = i;
            }
            for (var i = 13; i <= 14; i++) { //處理次一置月年的11月與12月,亦有可能含閏月
                //若次一陰曆臘月起始日大於附近的冬至中氣日,且陰曆正月起始日小於或等於大寒中氣日,則此月為閏月,次一正月同理.
                if (Math.floor((sjd[i] + 0.5) > Math.floor(qjd[i - 1 - yz] + 0.5) && Math.floor(sjd[i + 1] + 0.5) <= Math.floor(qjd[i - yz] + 0.5))) {
                    mc[i] = i - 0.5;
                    yz = 1; //標示遇到閏月
                } else {
                    mc[i] = i - yz; //遇到閏月開始,每個月號要減1
                }
            }
        }
		
		this.MC[yy] = mc;
		this.SM[yy] = sjd;
		
        return [mc, sjd];
    };
    /**
     * 将农历时间转换成公历时间 [年,月,日,附加资料]
     * @param int yy(-1000-3000)
     * @param int mm(1-12)
     * @param int dd(1-30)
     * @param boolean ry 是否闰月
     * @return false/array
     */
    this.Lunar2Solar = function(yy, mm, dd, ry) { //此為將陰曆日期轉換為陽曆日期的主程式
        var yy = this.intval(yy);
        var mm = this.intval(mm);
        var dd = this.intval(dd);
        var ry = this.boolval(ry);

		if(mm < 1 || mm > 12){ //月份錯誤
			return false;
		}
		if(dd < 1 || dd > 30){ //日期錯誤
			return false;
		}
		var ob = { //返回附加资料
			'leap':0, //闰月,以1为正月开始
			'days':[] //每月多少天[5][1] = 30;表示该年闰五月30天
		};
		var [mc, sjd] = this.GetZQandSMandLunarMonthCode(yy);
        var runyue = 0; //若閏月旗標為0代表無閏月
        for (var j = 1; j <= 14; j++) { //確認指定年前一年11月開始各月是否閏月
            if (mc[j] - Math.floor(mc[j]) > 0) { //若是,則將此閏月代碼放入閏月旗標內
                runyue = Math.floor(mc[j] + 0.5); //runyue=0對應陰曆11月,1對應陰曆12月,2對應陰曆隔年1月,依此類推.
				if(runyue >= 3){
					ob.leap = runyue - 2;
				}
                break;
            }
        }
        var mx = mm + 2; //11月對應到1,12月對應到2,1月對應到3,2月對應到4,依此類推
		var nofd = []; //大概是number of day的意思
        for (var i = 0; i <= 14; i++) { //求算陰曆各月之大小,大月30天,小月29天,0为农历11月
            nofd[i] = Math.floor(sjd[i + 1] + 0.5) - Math.floor(sjd[i] + 0.5); //每月天數,加0.5是因JD以正午起算
			if(mc[i] < 2){
				continue;
			}
			var m = Math.floor(mc[i] - 1); //月份
			if(m > 12){
				continue;
			}
			var j = (m == (mc[i] - 1)) ? 0 : 1; //是否闰月
			if(ob.days[m] == undefined){
				ob.days[m] = [];
			}
			ob.days[m][j] = nofd[i];
        }
        var er = 0; //若輸入值有錯誤,er值將被設定為对应错误代码
        if (ry == true) { //若有勾選閏月
			if (runyue < 3) { //而旗標非閏月或非本年閏月,則表示此年不含閏月,runyue=0代表無閏月,=1代表閏月為前一年的11月,=2代表閏月為前一年的12月
				er = 7; //此年非閏年
			} else { //若本年內有閏月
				if (runyue != mx) { //但不為輸入的月份
					er = 8; //則此輸入的月份非閏月
				} else { //若輸入的月份即為閏月
					if (dd <= nofd[mx]) { //若輸入的日期不大於當月的天數
						var jdx = sjd[mx] + dd - 1; //則將當月之前的JD值加上日期之前的天數
					} else { //日期超出範圍
						er = 4;
					}
				}
			}
		} else { //若沒有勾選閏月則
			if (runyue == 0) { //若旗標非閏月,則表示此年不含閏月(包括前一年的11月起之月份)
				if (dd <= nofd[mx - 1]) { //若輸入的日期不大於當月的天數
					var jdx = sjd[mx - 1] + dd - 1; //則將當月之前的JD值加上日期之前的天數
				} else { //日期超出範圍
					er = 4;
				}
			} else { //若旗標為本年有閏月(包括前一年的11月起之月份)
				//公式nofd(mx - (mx > runyue) - 1)的用意為:若指定月大於閏月,則索引用mx,否則索引用mx-1
				if (dd <= nofd[mx + (mx > runyue) - 1]) { //若輸入的日期不大於當月的天數
					var jdx = sjd[mx + (mx > runyue) - 1] + dd - 1; //則將當月之前的JD值加上日期之前的天數
				} else { //日期超出範圍
					er = 4;
				}
			}
		}
		if(er > 0){
			return false;
		}
		var [yi, mi, dz] = this.Jtime(jdx);
		
        return [yi, mi, dz, ob];
    };
    /**
     * 将公历时间转换成农历时间(古代历法来自寿星万年历) [年,月,日,是否闰月,附加资料]
     * @param int yy(-1000-3000)
     * @param int mm(1-12)
     * @param int dd(1-31)
     * @return false/array
     */
    this.Solar2Lunar = function(yy, mm, dd) {
        var yy = this.intval(yy);
        var mm = this.intval(mm);
        var dd = this.intval(dd);

        //驗證輸入日期的正確性,若不正確則跳離
        if (this.ValidDate(yy, mm, dd) === false) {
            return false;
        }
		var ob = { //返回附加资料,古代农历要用到
			'ym':'', //月建别名yue ming
			'yi':0, //正月初一定年份,所以改了月建要相应改年份,不具备唯一性仅供展示,要逆转到公历必须用返回中的[yi, mi, dz, ry]
			'gz':'', //干支纪年(以正月初一为界)
			'days':0 //该农历月份有多少天
		};
		var jdx = this.Jdays(yy, mm, dd, 12, 0, 0); //求出指定年月日之JD值
		
		//-721年至-104年的后九月及月建问题,与朔有关,与气无关.不同历法交汇,导致某些农历日期会对应到多个公历,所以这段时期不支持逆转到公历.如 -221-9-1 与 -221-10-31 的农历都是-221年十月初一
		if (jdx >= 1457698 && jdx <= 1683430) { //这一段来自寿星万年历,十九年七闰法:7个闰年均匀安插在19个年整数中,闰年的末月置为闰月
			var yi = 0; //定农历年份
			var mi = 0; //农历月份从1开始
			var dz = 0; //农历日期从1开始
			var ry = false; //是否闰月,只有闰九和闰十二
			var ii = 0; //该公历日期在第几轮循环中
			var ns = []; //年首相关信息,NianShou
			for (var i = 0,step = 3; i <= step; i++) { //计算连续的正月初一,对应的农历日期必定在此范围内
				var jd = 0;
				var YY = yy + i - 1; //可能所在的农历年份
				if (YY >= -220) { //秦汉历,19年7闰,年首为十月,mi=4为正月,闰年的末月置闰并取名"后九"月,1640641为历法生效时间公历-221.10.31
					jd = 1640641 + Math.floor(0.866 + (YY + 220) * 12.369000) * this.synmonth; //颁行历年首
					ns[i + 6] = '后九'; //闰月名称
					ns[i + 11] = 10; //表示第10个月置闰
				}else if (YY >= -479) { //战国历,19年7闰,年首为正月,闰年的末月置闰并取名闰"十三",1546083为历法生效时间公历-480.12.11
					jd = 1546083 + Math.floor(0.500 + (YY + 479) * 12.368422) * this.synmonth;
					ns[i + 6] = '十三';
					ns[i + 11] = 13; //表示第13个月置闰
				}else if (YY >= -722) { //春秋历,19年7闰,年首为正月,闰年的末月置闰并取名闰"十三",1457698为历法生效时间公历-722.12.17
					jd = 1457698 + Math.floor(0.342 + (YY + 721) * 12.368422) * this.synmonth;
					ns[i + 6] = '十三';
					ns[i + 11] = 13;
				}
				if(jd < 1457698){
					continue;
				}
				ns[i] = this.TrueNewMoon(jd, true);
				ns[i] = Math.floor(ns[i] + 0.5); //确保统一成整数
				if(jdx > ns[i]){
					continue;
				}
				
				ii = (jdx == ns[i]) ? i : (i - 1); //正好年初一那天
				yi = (jdx == ns[i]) ? YY : (YY - 1);
				step = ii + 1; //多算一个年初一以确定本年有多少个月
			}
			var tjd = [];
			for(var j = 0; j < 14; j++){ //逐步算出朔望日,得到闰月日期等
				var jd = (j == 0) ? ns[ii] : this.TrueNewMoon(tjd[j - 1] + this.synmonth + 14, true); //以jd值代入求瞬時朔望日
				jd = Math.floor(jd + 0.5); //确保统一成整数
				if(mi + dz == 0){ //还没找到过
					if(jdx == jd){ //正好是这个月初一
						mi = j + 1;
						dz = 1;
					}
					if(jdx < jd){ //在上一个月
						mi = j; //减一再加一
						dz = jdx - tjd[j - 1] + 1;
					}
				}
				tjd[j] = jd; //最后一个是下一年年初一的,用于计算每个月多少天
				if(jd >= ns[ii + 1]){ //下一年的年初一
					break;
				}
			}
			ob.yi = yi;
			ob.ym = this.dxy[(mi + ns[ii + 11] - 2)%12];
			ob.days = tjd[mi] - tjd[mi-1]; //该月多少天

			if(mi <= 12 - ns[ii + 11] + 1){ //正月之前算上一年
				ob.yi--;
			}
			if(tjd.length == 14){ //该年有闰月
				if(mi == 13){ //都是最后一个月置闰
					ry = true;
					ob.ym = ns[ii + 6]; //非常规,可能史书上称后九或十三
				}
			}
			
			ob.gz = this.gz[((ob.yi + 4712 + 24) % 60 + 60) % 60]; //干支纪年
			
			return [yi, mi, dz, ry, ob];
		}
		for(var ty = yy, flag = 0; ; ty--,flag = 1){
			var [mc, sjd] = this.GetZQandSMandLunarMonthCode(ty);
			if (Math.floor(jdx) >= Math.floor(sjd[0] + 0.5)) {
				break;
			}
		}
        for (var i = 0; i <= 14; i++) { //下面的指令中加0.5是為了改為從0時算起而不從正午算起
            if (Math.floor(jdx) >= Math.floor(sjd[i] + 0.5) && Math.floor(jdx) < Math.floor(sjd[i + 1] + 0.5)) {
                var mi = i;
                break;
            }
        }
        var dz = Math.floor(jdx) - Math.floor(sjd[mi] + 0.5) + 1; //此處加1是因為每月初一從1開始而非從0開始
		var dn = Math.floor(sjd[mi + 1] + 0.5) - Math.floor(sjd[mi] + 0.5); //该月多少天
		
        if (mc[mi] < 2 || flag == 1) {
            var yi = yy - 1;
        } else {
            var yi = yy;
        } //因mc(mi)=0對應到前一年陰曆11月,mc(mi)=1對應到前一年陰曆12月
        //mc(mi)=2對應到本年1月,依此類推
        if ((mc[mi] - Math.floor(mc[mi])) * 2 + 1 == 1) {
            var ry = false;
        } else {
            var ry = true;
        }
        var mi = (Math.floor(mc[mi] + 10) % 12) + 1; //對應到月份

		ob.yi = yi;
		ob.days = dn;
		ob.ym = this.dxy[mi - 1]; //月建对应的默认月名称:建子十一,建丑十二,建寅为正...
		
		var Dm = jdx - dz + 1; //这个月的初一儒略日
		if (Dm >= 1724360 && Dm <= 1729794) { //8.01.15至 23.12.02 建子为十二,其它顺推.这个1724360是9.01.15,不知道是不是寿星笔误
			ob.ym = this.dxy[mi%12];
			if(mi == 12){ //腊月变成了下一年
				ob.yi++;
			}
		} else if (Dm >= 1807724 && Dm <= 1808699) { //237.04.12至239.12.13 建子为十二,其它顺推
			ob.ym = this.dxy[mi%12];
			if(mi == 12){ //腊月变成了下一年
				ob.yi++;
			}
		} else if (Dm >= 1999349 && Dm <= 1999467) { //761.12.02至762.03.30 建子为正月,其它顺推
			ob.ym = this.dxy[(mi + 1)%12];
			if(mi == 11 || mi == 12){ //正月腊月算到下一年
				ob.yi++;
			}
		} else if (Dm >= 1973067 && Dm <= 1977052) { //689.12.18至700.11.15 建子为正月,建寅为一月,其它不变.一整年变为: 正月,腊月,一月,二月,三月...
			if (mi == 11) {
				ob.ym = "正";
			}
			if (mi == 1) {
				ob.ym = '一';
			}
			if(mi == 11 || mi == 12){ //正月腊月算到下一年
				ob.yi++;
			}
		} 
		if (Dm == 1729794 || Dm == 1808699) {
			ob.ym = '拾贰'; //239.12.13及23.12.02均为十二月,为避免两个连续十二月，此处改名
		}
		
		ob.gz = this.gz[((ob.yi + 4712 + 24) % 60 + 60) % 60]; //干支纪年
		
        return [yi, mi, dz, ry, ob];
    };
    /**
     * 计算公历的某天是星期几(PHP中的date方法,此处演示儒略日历的转换作用) this.wkd[i]
     * @param int yy(-1000-3000)
     * @param int mm(1-12)
     * @param int dd(1-31)
     * @return false/int
     */
    this.GetWeek = function(yy, mm, dd) {
        var yy = this.intval(yy);
        var mm = this.intval(mm);
        var dd = this.intval(dd);

        var spcjd = this.Jdays(yy, mm, dd, 12, 0, 0);
        if (spcjd === false) {
            return false;
        }

        return (((Math.floor(spcjd + 1) % 7)) + 7) % 7; //模數(或餘數)為0代表星期日(因为西元前4713年1月1日12時为星期一).spcjd加1是因起始日為星期一
    };
    /**
     * 获取公历某个月有多少天
     * @param int yy(-1000-3000)
     * @param int mm(1-12)
     * @return number
     */
    this.GetSolarDays = function(yy, mm) {
        var yy = this.intval(yy);
        var mm = this.intval(mm);

        if (mm < 1 || mm > 12) { //月份超出範圍
            return 0;
        }
        if (yy == 1582 && mm == 10) { //这年这个月的5到14日不存在,所以1582年10月只有21天
            return 21;
        }
        var ndf1 = -(yy % 4 == 0); //可被四整除
        var ndf2 = ((yy % 400 == 0) - (yy % 100 == 0)) && (yy > 1582);
        var ndf = ndf1 + ndf2;
        return 30 + ((Math.abs(mm - 7.5) + 0.5) % 2) - (mm == 2) * (2 + ndf);
    };
	/**
     * 获取农历某个月有多少天
     * @param int yy(-1000-3000)
     * @param int mm(1-12)
     * @param bool ry 是否闰月
     * @return number
     */
    this.GetLunarDays = function(yy, mm, ry){
        yy = this.intval(yy);
        mm = this.intval(mm);
        ry = this.boolval(ry);
        
        var a = this.Lunar2Solar(yy, mm, 1, ry);
		if(a == false){ //比如年份超出范围或该月不是闰月
            return 0;
        }
        var ob = a[3];
        var days = ob['days'];
        return days[mm][ry?1:0];
    };
    /**
     * 获取农历某年的闰月,0为无闰月
     * @param int yy(-1000-3000)
     * @return number
     */
    this.GetLeap = function (yy){
        yy = this.intval(yy);
        
        var a = this.Lunar2Solar(yy, 1, 1, false);
		if(a == false){
            return 0;
        }
        var ob = a[3];
        return ob['leap'];
    };
    /**
     * 根据公历年月日精确计算星座下标 this.cxz[xz]
     * @param int yy(-1000-3000)
     * @param int mm(1-12)
     * @param int dd(1-31)
     * @param int hh(0-23)
     * @param int mt(0-59),分钟
     * @param int ss(0-59),秒数
     * @return int|false
     */
	this.GetXZ = function(yy, mm, dd, hh, mt, ss) {
        var yy = this.intval(yy);
        var mm = this.intval(mm);
        var dd = this.intval(dd);
        var hh = (hh === undefined) ? 0 : this.intval(hh);
        var mt = (mt === undefined) ? 0 : this.intval(mt);
        var ss = (ss === undefined) ? 0 : this.intval(ss);
		
        if (this.ValidDate(yy, mm, dd) === false) {
            return false;
        }
		
        var spcjd = this.Jdays(yy, mm, dd, hh, mt, ss); //special jd
        if (spcjd === false) {
            return false;
        }
		for(var ty = yy; ; ty--){ //春分开始,以两气之间为单位
			var jq = this.GetAdjustedJQ(ty, false);
			if (spcjd >= jq[0]) {
				break;
			}
			
		}
        for (var i = 0,xz = 2; i <= 22; i += 2) { //默认是春分之前的那个
            if (spcjd < jq[i]) {
                var xz = (i/2 - 1 + 3) % 12;
                break;
            } //即為指定時刻所在的節氣月首JD值
        }
        return xz;
    };
    /**
     * 四柱計算,根据this.zwz决定是否分早子时晚子时,传公历
     * @param int yy(-1000-3000)
     * @param int mm(1-12)
     * @param int dd(1-31)
     * @param int hh(0-23)
     * @param int mt(0-59),分钟,在跨节的时辰上会需要,有的排盘忽略跨节
     * @param int ss(0-59),秒数
     * @return false/array(天干, 地支, 附加资料)
     */
    this.GetGZ = function(yy, mm, dd, hh, mt, ss) {
        var yy = this.floatval(yy);
        var mm = this.floatval(mm);
        var dd = this.floatval(dd);
        var hh = this.floatval(hh);
        var mt = (mt === undefined) ? 0 : this.floatval(mt);
        var ss = (ss === undefined) ? 0 : this.floatval(ss);

        if (mt + ss == 0) { //避免整点模糊
            ss = 10;
        }

        if (this.ValidDate(yy, mm, dd) === false) {
            return false;
        }

        var spcjd = this.Jdays(yy, mm, dd, hh, mt, ss);
        if (spcjd === false) {
            return false;
        }
		
		var jr = [];
		for(var ty = yy; ; ty--){ //公历年的立春在前一年春分开始的数组中
			var dj = this.GetAdjustedJQ(ty, false);
			jr = dj.concat(jr); //往前插入
			if(spcjd >= dj[21]){ //dj[21]為立春,約在2月5日前後,若小於dj[21],則屬於前一個節氣年
				ty++;
				break;
			}
		}

        var tg = [];
        var dz = [];
        var ygz = ((ty + 4712 + 24) % 60 + 60) % 60;
        tg[0] = ygz % 10; //年干
        dz[0] = ygz % 12; //年支
        for (var j = 0; ; j++) {
            if (spcjd < jr[21 + 2*j]) {
                var tm = j - 1;
                break;
            } //已超過指定時刻,故應取前一個節氣
        }

        var tmm = ((ty + 4712) * 12 + tm + 60) % 60;
        var mgz = (tmm + 50) % 60;
        tg[1] = mgz % 10; //月干
        dz[1] = mgz % 12; //月支
        //計算日柱之干支 
        var jda = spcjd + 0.5; //加0.5是將起始點從正午改為從0點開始
        var thes = ((jda - Math.floor(jda)) * 86400) + 3600; //將jd的小數部份化為秒,並加上起始點前移的一小時(3600秒),取其整數值
        var dayjd = Math.floor(jda) + thes / 86400; //將秒數化為日數,加回到jd的整數部份
        var dgz = (Math.floor(dayjd + 49) % 60 + 60) % 60;
        tg[2] = dgz % 10; //日干
        dz[2] = dgz % 12; //日支
        if (this.zwz && (hh >= 23)) { //区分早晚子时,日柱前移一柱
            tg[2] = (tg[2] + 10 - 1) % 10;
            dz[2] = (dz[2] + 12 - 1) % 12;
        }
        //計算時柱之干支
        var dh = dayjd * 12;
        var hgz = (Math.floor(dh + 48) % 60 + 60) % 60;
        tg[3] = hgz % 10; //時干
        dz[3] = hgz % 12; //時支
		
		var ob = {
			ty: ty,
			jr: jr
		};
        return [tg, dz, ob];
    };
    /**
     * 根据年干支计算所有合法的月干支
     * @param int ygz(0-59) 年柱干支代码
     * @return array 月柱干支代码列表
     */
    this.MGZ = function(ygz) {
		var ygz = this.intval(ygz);
		
        var mgz = [];

        //var ygz = this.gz.indexOf(ygz);

        var nv = 2 + 12 * (ygz % 10);
        for (var i = 0; i <= 11; i++) {
            var pv = (i + nv) % 60;
            mgz[pv] = this.gz[pv];
        }
        return mgz;
    };
    /**
     * 根据日干支计算所有合法的时干支
     * @param int dgz(0-59) 日柱干支代码
     * @return array 时柱干支代码列表
     */
    this.HGZ = function(dgz) {
		var dgz = this.intval(dgz);
		
        var hgz = [];

        //var dgz = this.gz.indexOf(dgz);

        var nv = 12 * (dgz % 10);
        for (var i = 0; i <= (this.zwz?12:11); i++) { //考虑晚子时
            var pv = (i + nv) % 60;
            hgz[pv] = this.gz[pv] + (i == 12 ? '+' : ''); //+号在查找方法中要用到
        }
        return hgz;
    };
    /**
     * 根据一柱天干地支代码计算该柱的六十甲子代码
     * @param int tg(0-9) 天干代码
     * @param int dz(0-11) 地支代码
     * @return false/int 干支代码
     */
    this.GZ = function(tg, dz) {
        var tg = this.intval(tg);
        var dz = this.intval(dz);

        if (tg < 0 || tg > 9) {
            return false;
        }

        if (dz < 0 || dz > 11) {
            return false;
        }

        if ((tg % 2) != (dz % 2)) { //偶数对偶数,奇数对奇数才能组成一柱
            return false;
        }
        return ((10 + tg - dz) % 10) / 2 * 12 + dz;
    };
    /**
     * 根据八字干支查找对应的公历日期(GanZhi To GongLi)
     * @param int ygz(0-59) 对应的是this.gz
     * @param int mgz(0-59)
     * @param int dgz(0-59)
     * @param int hgz(0-59)
     * @param int yeai(-1000-3000) 起始年 year initial
     * @param int mx 查找多少个甲子
     */
    this.gz2gl = function(ygz, mgz, dgz, hgz, yeai, mx) {
        var ygz = this.intval(ygz);
        var mgz = this.intval(mgz);
        var dgz = this.intval(dgz);
        var hgz = this.intval(hgz);
        var yeai = this.intval(yeai);
        var mx = this.intval(mx);

        if (ygz < 0 || ygz >= 60) { //年干支非六十甲子
            return false;
        }
        if (mgz < 0 || mgz >= 60) { //月干支非六十甲子
            return false;
        }
        if (dgz < 0 || dgz >= 60) { //日干支非六十甲子
            return false;
        }
        if (hgz < 0 || hgz >= 60) { //时干支非六十甲子
            return false;
        }

        if (!(mgz in this.MGZ(ygz))) { //对应的月干支不存在
            return false;
        }
        if (!(hgz in this.HGZ(dgz))) { //对应的时干支不存在
            return false;
        }
		var hgzs = this.HGZ(dgz); //该日下所有时柱
		if(this.zwz && (hgzs[hgz].substr(-1) == '+')){ //晚子时,日柱后挪一天
			dgz = (dgz + 1) % 60;
		}
        var yeaf = yeai + mx * 60;

        var ifs = []; //initial-final 返回一个含起止时间的数组

        for (var m = 0; m <= mx - 1; m++) {
            var yea = yeai + m * 60;

            //將年月干支對應到指定年的節氣月起始時刻
            var syc = (yea + 56) % 60; //已知公元0年为庚申年,庚申的六十甲子代码为56,这里求得yea的六十甲子代码syc
            var asyc = (ygz + 60 - syc) % 60; //年干支代码相对yea干支代码偏移了多少
            var iy = yea + asyc; //加上偏移即得一个ygz年

            var mgzo = (mgz + 60 - 2) % 12; //已知干支代碼,要求干支名,只需將干支代碼除以10,所得的餘數即為天干的代碼;將干支代碼除以12,所得的餘數即為地支的代碼.这里求得mgz在第几个月

			var jdpjq = [];
			for(var ty = iy - 1; ty <= iy; ty++){ //前一年春分开始的节气
				var dj = this.GetAdjustedJQ(ty, false);
				jdpjq = jdpjq.concat(dj);
			}
            var ijd = jdpjq[21 + 2*mgzo]; //節氣月頭JD initial jd 21立春
            var fjd = jdpjq[21 + 2*mgzo + 2]; //節氣月尾JD final jd

            var sdc = (Math.floor(ijd) + 49) % 60; //節氣月頭的日干支代碼,儒略日历时间0日为癸丑日,六十甲子代码为49
            var asdc = (dgz + 60 - sdc) % 60; //生日相對於節氣月頭的日數
            var idd = Math.floor(ijd + asdc); //生日JD值(未加上時辰)
            var ihh = hgz % 12; //時辰代碼
            var id = idd + (ihh * 2 - 13) / 24;
            var fd = idd + (ihh * 2 - 11) / 24;

            if (fd < ijd || id > fjd) { //此八字在此60年中不存在

            } else {
                if (id > ijd && fd < fjd) { //没有跨节
                    var ids = id;
                    var fds = fd;
                }
                if (id < ijd && fd > ijd) { //同一个时辰跨越了节:在節氣月頭,只包含時辰後段
                    var ids = ijd;
                    var fds = fd;
                }
                if (id < fjd && fd > fjd) { //同一个时辰跨越了节:在節氣月尾,只包含時辰前段
                    var ids = id;
                    var fds = fjd;
                }
                ifs.push([this.Jtime(ids), this.Jtime(fds)]); //儒略日历时间转成公历时间.如果开启早晚子并且是子时这里有点瑕疵,但考虑到跨节这里有点复杂
            }
        }
        return ifs;
    };
    /**
     * 根据公历年月日计算命盘信息 fate:命运 map:图示
     * @param int xb 性别0男1女
     * @param int yy 年份(-1000-3000).确保传的是this.J对应的时间
     * @param int mm 月份(1-12)
     * @param int dd 日期(1-31)
     * @param int hh 时间(0-23)
     * @param int mt 分钟(0-59),在跨节的时辰上会需要,有的排盘忽略了跨节,不需要考虑跨节则请把时间置为对应时辰的初始值
     * @param int ss 秒数(0-59),在跨节的时辰上会需要,有的排盘忽略了跨节
	 * @param float J 所在经度(角度表示)用于计算真太阳时,不传则用标准时间排盘
	 * @param float W 所在纬度(角度表示)不传则默认北纬35度
     * @return false/array
     */
    this.fatemaps = function(xb, yy, mm, dd, hh, mt, ss, J, W) {
        var xb = this.intval(xb) ? 1 : 0; //确保准确
        var yy = this.intval(yy);
        var mm = this.intval(mm);
        var dd = this.intval(dd);
        var hh = this.intval(hh);
        var mt = (mt === undefined) ? 0 : this.intval(mt);
        var ss = (ss === undefined) ? 0 : this.intval(ss);

        var spcjd = this.Jdays(yy, mm, dd, hh, mt, ss); //special jd,这里依然是标准时间,即this.J处的平太阳时
        if (spcjd === false) {
            return false;
        }
		
		var rt = []; //要返回的数组 return
		
		if(J !== undefined){ //有传参,需要转地方真太阳时
			rt['pty'] = spcjd - (this.J - this.floatval(J)) * 4 / 60 / 24; //计算地方平太阳时,每经度时差4分钟
			rt['pty'] = this.Jtime(rt['pty']); //地方平太阳时

			spcjd = this.zty(spcjd, J, W); //采用真太阳时排盘,这里有点疑问: 对应的廿四节气的计算是否也要转为真太阳时呢?
			rt['zty'] = this.Jtime(spcjd); //地方真太阳时
		}
		
        var [yy, mm, dd, hh, mt, ss] = this.Jtime(spcjd); //假设hh传了>24的数字,此处修正

        var nwx = [0, 0, 0, 0, 0]; //五行数量 number of WuXing 这里不计算藏干里的
        var nyy = [0, 0]; //阴阳数量 number of YinYang 这里不计算藏干里的

        var szs = [1, 6, 10, 9, 10, 9, 7, 0, 4, 3]; //日干對地支爲"子"者所對應的運程代碼

        var [tg, dz, ob] = this.GetGZ(yy, mm, dd, hh, mt, ss);

        //計算年月日時辰等四柱干支的陰陽屬性和個數及五行屬性和個數
        var yytg = []; //YinYang TianGan
        var yydz = []; //YinYang DiZhi
        var ewxtg = []; //各天干对应的五行
        var ewxdz = []; //各地支对应的五行
        for (var k = 0; k <= 3; k++) { //yytg:八字各柱天干之陰陽屬性,yydz:八字各柱地支之陰陽屬性,nyy[0]為陽之總數,nyy[1]為陰之總數
            yytg[k] = tg[k] % 2;
            nyy[yytg[k]] = nyy[yytg[k]] + 1; //求天干的陰陽並計算陰陽總數

            yydz[k] = dz[k] % 2;
            nyy[yydz[k]] = nyy[yydz[k]] + 1; //求地支的陰陽並計算陰陽總數

            ewxtg[k] = this.wxtg[tg[k]];
            nwx[ewxtg[k]] = nwx[ewxtg[k]] + 1; //wxtg為天干之五行屬性

            ewxdz[k] = this.wxdz[dz[k]];
            nwx[ewxdz[k]] = nwx[ewxdz[k]] + 1; //wxdz為地支之五行屬性
        }

        rt['nyy'] = nyy; //阴阳数量
        rt['nwx'] = nwx; //五行数量

        rt['yytg'] = yytg; //各天干对应的阴阳
        rt['yydz'] = yydz; //各地支对应的阴阳

        rt['ewxtg'] = ewxtg; //各天干对应的五行
        rt['ewxdz'] = ewxdz; //各地支对应的五行

        //日主與地支藏干決定十神
        var bzcg = []; //各地支的藏干
        var wxcg = []; //各地支的藏干对应的五行
        var yycg = []; //各地支的藏干对应的阴阳
        var bctg = []; //各地支的藏干对应的文字
        for (var i = 0; i <= 3; i++) { //0,1,2,3等四個
            wxcg[i] = [];
            yycg[i] = [];
            for (var j = 0; j <= 2; j++) { //0,1,2等三個
                var nzcg = this.zcg[dz[i]][j]; //取得藏干表中的藏干代碼,zcg為一 4X3 之array the number of 支藏干
                if (nzcg >= 0) { //若存在則取出(若為-1,則代表空白)
                    bctg[3 * i + j] = this.ctg[nzcg]; //暫存其干支文字
                    bzcg[3 * i + j] = this.sss[this.dgs[nzcg][tg[2]]]; //暫存其所對應之十神文字

                    wxcg[i][j] = this.wxtg[nzcg]; //其五行屬性
                    yycg[i][j] = nzcg % 2; //其陰陽屬性
                } else {
                    bctg[3 * i + j] = ""; //若nzcg為-1,則代表空白,設定藏干文字變數為空白
                    bzcg[3 * i + j] = ""; //若nzcg為-1,則代表空白,設定十神文字變數為空白
                }
            }
        }
        rt['bctg'] = bctg;
        rt['bzcg'] = bzcg;
        rt['wxcg'] = wxcg;
        rt['yycg'] = yycg;

        //求算起運時刻
        for (var i = 0; ; i++) { //先找到指定時刻前後的節氣月首
            if (spcjd < ob.jr[21 + 2*i]) {
                var ord = i - 1;
                break;
            } //ord即為指定時刻所在的節氣月首JD值
        }
		
		var ta = this.pdy ? this.ty : 360; //一個廻歸年的天數
		
        var xf = spcjd - ob.jr[21 + 2*ord]; //xf代表節氣月的前段長,單位為日,以指定時刻為分界點
        var yf = ob.jr[21 + 2*ord + 2] - spcjd; //yf代表節氣月的後段長
        if (((xb == 0) && (yytg[0] == 0)) || ((xb == 1) && (yytg[0] == 1))) {
			if(this.pdy){
				var zf = ta * 10 * (yf / (yf + xf)); //zf為指定日開始到起運日之間的總日數(精確法)
			}else{
				var zf = ta * 10 * (yf / 30); //zf為指定日開始到起運日之間的總日數(粗略法）三天折合一年,一天折合四个月,一个时辰折合十天,一个小时折合五天,反推得到一年按360天算,一个月按30天算
			}
            var forward = 0; //陽年男或陰年女,其大運是順推的
        } else {
			if(this.pdy){
				var zf = ta * 10 * (xf / (yf + xf)); //陰年男或陽年女,其大運是逆推的
			}else{
				var zf = ta * 10 * (xf / 30); //(粗略法)
			}
            var forward = 1;
        }
		var y = this.intval(zf / ta);
		var m = this.intval(zf % ta / (ta / 12));
		var d = this.intval(zf % ta % (ta / 12));
		
        rt['qyy_desc'] = "出生后" + y + "年" + m + "个月" + d + "天起运"; //与十三行八字一致
		
        var qyt = spcjd + (y + m/12 + d/this.ty)*this.ty; //转按回归年算
        var jt = this.Jtime(qyt); //將起運時刻的JD值轉換為年月日時分秒
        var qyy = jt[0]; //起運年(公历)

        rt['qyy'] = qyy; //起運年

        //求算起運年(指節氣年,农历)
        var qjr = this.GetAdjustedJQ(qyy - 1, false); //立春在上一年的以春分开始的数组中
        if (qyt >= qjr[21]) { //qjr[21]為立春,約在2月5日前後,
            var jqyy = qyy;
        } else {
            var jqyy = qyy - 1; //若小於jr[21],則屬於前一個節氣年
        }

        //求算起運年及其後第五年的年干支及起運歲
        var jtd = ((jqyy + 4712 + 24) % 10 + 10) % 10;
        jtd = this.ctg[((jqyy + 4712 + 24) % 10 + 10) % 10] + "、" + this.ctg[((jqyy + 4712 + 24 + 5) % 10 + 10) % 10];
        rt['qyy_desc2'] = "每逢 " + jtd + " 年" + jt[1] + "月" + jt[2] + "日" + jt[3] + "时交脱大运"; //顯示每十年為一階段之起運時刻,分兩個五年以年天干和陽曆日期表示
        var qage = jqyy - ob.ty; //起運年減去出生年再加一即為起運之歲數,從懷胎算起,出生即算一歲

        rt['dy'] = []; //大运

        //下面的回圈計算起迄歲,大運干支(及其對應的十神),衰旺吉凶
        var zqage = []; //起始歲數
        var zboz = []; //末端歲數
        var zfman = []; //大運月干代码
        var zfmbn = []; //大運月支代码
        var zfma = []; //大運月干文字
        var zfmb = []; //大運月支文字
        var nzs = []; //大运对应的十二长生
        var mgz = ((10 + tg[1] - dz[1]) % 10) / 2 * 12 + dz[1]; //这里是根据天干地支代码计算月柱的六十甲子代码
        for (var k = 0; k <= 8; k++) { //求各階段的起迄歲數及該階段的大運
            if (rt['dy'][k] === undefined) {
                rt['dy'][k] = [];
            }
            //求起迄歲
            rt['dy'][k]['zqage'] = zqage[k] = qage + 1 + k * 10; //求各階段的起始歲數
            rt['dy'][k]['zboz'] = zboz[k] = qage + 1 + k * 10 + 9; //求各階段的末端歲數

            //求起讫年
            rt['dy'][k]['syear'] = qyy + k * 10;
            rt['dy'][k]['eyear'] = qyy + k * 10 + 9;

            //排大運
            //求大運的數值表示值,以出生月份的次月干支開始順排或以出生月份的前一個月干支開始逆排
            //大運月干
            rt['dy'][k]['zfman'] = zfman[k] = (mgz + 60 + Math.pow(-1, forward) * (k + 1)) % 10; //加60是為保證在Mod之前必為正數
            //大運月支
            rt['dy'][k]['zfmbn'] = zfmbn[k] = (mgz + 60 + Math.pow(-1, forward) * (k + 1)) % 12; //加60是為保證在Mod之前必為正數

            rt['dy'][k]['zfma'] = zfma[k] = this.ctg[zfman[k]];
            rt['dy'][k]['zfmb'] = zfmb[k] = this.cdz[zfmbn[k]];

            //算衰旺吉凶ncs
            //szs(tg(2))爲日干對大運地支爲"子"者所對應之運程代碼
            //tg(2)爲生日天干(以整數0~11表示)之代碼
            //(-1)^tg(2)表示若日干爲陽則取加號,若日干爲陰則取减號
            //第一個大運之地支數值爲zfmbn(0)
            //下式中szs(tg(2)) + (-1) ^ tg(2) * (zfmbn(0))為決定起始運勢,(-1) ^ forward * (-1) ^ tg(2) 為決定順推或逆推,可合併簡化為次一式
            rt['dy'][k]['nzs'] = nzs[k] = (24 + szs[tg[2]] + Math.pow(-1, tg[2]) * (zfmbn[0] + Math.pow(-1, forward) * k)) % 12;
            rt['dy'][k]['nzsc'] = this.czs[nzs[k]];
            //此處加24是爲了使Mod之前總值不爲負值
        }

        //求流年的數值表示值及對應的文字
        var lyean = []; //流年天干
        var lyebn = []; //流年地支
        var lye = []; //流年所對應的干支文字
        for (var j = 0; j <= 89; j++) {
            var k = this.intval(j / 10); //大运
            var i = j % 10; //流年
            if (rt['dy'][k]['ly'] === undefined) { //大运对应的流年
                rt['dy'][k]['ly'] = [];
            }
            if (rt['dy'][k]['ly'][i] === undefined) {
                rt['dy'][k]['ly'][i] = [];
            }
            //lyean[j]=(ygz + j + qage) % 10;
            rt['dy'][k]['ly'][i]['age'] = j + qage + 1; //年龄(虚岁)
            rt['dy'][k]['ly'][i]['year'] = j + qage + ob.ty; //流年(农历)
            rt['dy'][k]['ly'][i]['lyean'] = lyean[j] = (tg[0] + j + qage) % 10; //流年天干
            rt['dy'][k]['ly'][i]['lyebn'] = lyebn[j] = (dz[0] + j + qage) % 12; //流年地支
            rt['dy'][k]['ly'][i]['lye'] = lye[j] = this.ctg[lyean[j]] + this.cdz[lyebn[j]]; //取流年所對應的干支文字
        }

		var xz = this.GetXZ(yy, mm, dd, hh, mt, ss);

        rt['mz'] = this.mz[xb]; //命造乾坤
        rt['xb'] = this.xb[xb]; //性别0男1女
        rt['gl'] = [yy, mm, dd]; //公历生日
        rt['nl'] = this.Solar2Lunar(yy, mm, dd); //农历生日
        rt['tg'] = tg; //八字天干数组
        rt['dz'] = dz; //八字地支数组
        rt['sz'] = []; //四柱字符
        rt['ctg'] = []; //天干字符
        rt['cdz'] = []; //地支字符
        for (var i = 0; i <= 3; i++) {
            rt['sz'][i] = this.ctg[tg[i]] + this.cdz[dz[i]];
            rt['ctg'][i] = this.ctg[tg[i]];
            rt['cdz'][i] = this.cdz[dz[i]];
        }
        rt['sx'] = this.csx[dz[0]]; //生肖,與年地支對應
        rt['xz'] = this.cxz[xz]; //星座
        rt['cyy'] = this.cyy[yytg[2]]; //日干阴阳

        return rt;
    };
}
window.p = new paipan();